[erlang-questions] some help with hackney and multipart
Caragea Silviu
silviu.cpp@REDACTED
Wed Mar 9 11:31:09 CET 2016
Hello,
I'm trying to send an email via mailgun.com using the hackney and I have
some issues sending attachments (which requires multipart).
https://documentation.mailgun.com/api-sending.html#sending
Basically my interest fields are:
from
to
subject
text
attachment File attachment. You can post multiple attachment values.
Important: You must use multipart/form-data encoding when sending
attachments.
I tried the following:
PayloadBase =[
{<<"from">>, From},
{<<"to">>, To},
{<<"subject">>, Subject},
{<<"text">>, TextBody},
{<<"html">>, HtmlBody}
],
Payload = case Attachment of
null ->
{form, PayloadBase};
_->
{multipart, PayloadBase ++ [{file, Attachment}]}
end,
But for some reason the attachment is not sent.. Everything else works as
expected.
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
Silviu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160309/bf666e0c/attachment.htm>
More information about the erlang-questions
mailing list