<div dir="ltr"><div>Sorry for the late answer, between traveling, recovering and welcome back meetings I have been busy :)</div><div><br></div>The way the file is given is the standard way on the web. If you want to pass another name, why not using the form:<div><br></div><div><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre">({</span><span class="pl-smi" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre">Name</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre">, </span><span class="pl-smi" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre">Bin</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre">, </span><span class="pl-smi" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre">ExtraHeaders</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre">}, </span><br></div><div><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre"><br></span></div>If you really need to stream the file, a new pattern can be added I think. Let me know what's you're trying to do.<div><br></div><div>- benoit<br><div><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.8px;white-space:pre"><br></span></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Mar 12, 2016 at 9:02 PM Caragea Silviu <<a href="mailto:silviu.cpp@gmail.com">silviu.cpp@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I tested and what I see is that hackeny also use for files the name "file". I don't see how I can customize this as time mailgun search for attachment. <br><br>Also looking to <a href="https://github.com/benoitc/hackney/blob/de35c1ec93dca89568b8b32cf053d82277a90762/src/hackney_multipart.erl" target="_blank">https://github.com/benoitc/hackney/blob/de35c1ec93dca89568b8b32cf053d82277a90762/src/hackney_multipart.erl</a> <br><br></div>line 228 this seems hard-coded:<br><br> <span>Disposition</span> <span>=</span> {<<<span><span>"</span>form-data<span>"</span></span>>>,
[{<<<span><span>"</span>name<span>"</span></span>>>, <<<span><span>"</span><span>\"</span>file<span>\"</span><span>"</span></span>>>},
{<<<span><span>"</span>filename<span>"</span></span>>>, <<<span><span>"</span><span>\"</span><span>"</span></span>, <span>FName</span>/<span>binary</span>, <span><span>"</span><span>\"</span><span>"</span></span>>>}]},<br></div>Silviu<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 9, 2016 at 12:55 PM, Hynek Vychodil <span dir="ltr"><<a href="mailto:vychodil.hynek@gmail.com" target="_blank">vychodil.hynek@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<br>Try compare what is sent in body of request made by example with your one sent by hackney<div><br><div><div>curl -s --user 'api:YOUR_API_KEY' \</div><div> <a href="https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages" target="_blank">https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages</a> \</div><div> -F from='Excited User <YOU@YOUR_DOMAIN_NAME>' \</div><div> -F to='<a href="mailto:foo@example.com" target="_blank">foo@example.com</a>' \</div><div> -F cc='<a href="mailto:bar@example.com" target="_blank">bar@example.com</a>' \</div><div> -F bcc='<a href="mailto:baz@example.com" target="_blank">baz@example.com</a>' \</div><div> -F subject='Hello' \</div><div> -F text='Testing some Mailgun awesomness!' \</div><div> --form-string html='<html>HTML version of the body</html>' \</div><div> -F attachment=@files/cartman.jpg \</div><div> -F attachment=@files/cartman.png<br><br>Your {multipart, PayloadBase ++ [{file, Attachment}]} doesn't make much sense to me. Try something like {multipart, [{form, PayloadBase},{file, Attachment}]} (untested).</div></div></div><div><br></div><div>Hynek</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Wed, Mar 9, 2016 at 11:31 AM, Caragea Silviu <span dir="ltr"><<a href="mailto:silviu.cpp@gmail.com" target="_blank">silviu.cpp@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div>
<div>
<div><br><br>Hello,<br><br>I'm trying to send an email via <a href="http://mailgun.com" target="_blank">mailgun.com</a> using the hackney and I have some issues sending attachments (which requires multipart).<br><br><a href="https://documentation.mailgun.com/api-sending.html#sending" target="_blank">https://documentation.mailgun.com/api-sending.html#sending</a><br><br>Basically my interest fields are:<br><br> from<br> to<br> subject<br> text<br> attachment File attachment. You can post multiple attachment values. Important: You must use multipart/form-data encoding when sending attachments.<br><br>I tried the following:<br><br>PayloadBase =[<br> {<<"from">>, From},<br> {<<"to">>, To},<br> {<<"subject">>, Subject},<br> {<<"text">>, TextBody},<br> {<<"html">>, HtmlBody}<br>],<br><br>Payload = case Attachment of<br> null -><br> {form, PayloadBase};<br> _-><br> {multipart, PayloadBase ++ [{file, Attachment}]}<br>end,<br><br>But for some reason the attachment is not sent.. Everything else works as expected.<br>I don't see how I can set the filed name to "attachment" as required by mailgun .. at this this is what I suspect beeing wrong<span><font color="#888888"><br><br>Silviu<br><br></font></span></div>
</div>
</div></div>
<br></div></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>