-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multipart needs more examples #292
Comments
More or less this seems to be a hackney bug/limitation. Seems when you send a file the name is hard-coded to "file" and you cannot change it into something else. : like for example attachment as required by mailgun. I also found this code where hackney is doing this:
Any idea if my theory is true ? Silviu |
Nothing prevent you to use your own solution either in stream or in the given body using The code that handle the file is here: and the mp file header: If something is missing let me know. |
Hello, I think adding the possibility to customize the name and file name on the existing file support [{file, ...}] support will provide developers more freedom. Silviu |
well this is exactly what you can do here: https://github.com/benoitc/hackney/blob/master/src/hackney_multipart.erl#L232 For example: FName = hackney_bstr:to_binary(filename:basename(Path)),
MyName = <<"attachments">>
Disposition = {<<"form-data">>,
[{<<"name">>, <<"\"", MyName/binary, "\"">>},
{<<"filename">>, <<"\"", FName/binary, "\"">>}]},
ExtraHeaders = [],
{file, Path, Disposition, ExtraHeaders} I am not sure it needs another case. I already handle too much specific cases already :) |
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:
I tried the following:
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 "attachement" as required by mailgun
Silviu
The text was updated successfully, but these errors were encountered: