mailman-elixir / mailman

Mailman provides a clean way of defining mailers in your Elixir applications
https://github.com/mailman-elixir/mailman
Other
203 stars 73 forks source link

Apple mobileconfig MIME type, default type for unknown MIME, Path bug-fix #18

Closed dejanstrbac closed 9 years ago

dejanstrbac commented 9 years ago

Thanks for the plugin. Here are some updates on issues we encountered.

The mime list is obviously incomplete. I am including here the support for Apple's mobileconfig profiles, but still need some thought on how to be more flexible with the mime types. Also added the support for unknown MIME types. I think it's better to let developers attach anything and just use generic MIME type if format is unrecognised.

There was no need to have the leading dot added to the file_path, since it is being expanded, and expansion takes care of the current dir dot:

iex(1)> Path.expand("tmp") == Path.expand( Path.join(".", "tmp")) true

All tests passing.

Cheers!

UPDATE

\ sorry, I made the first PR from master, and since I have to use my master in mix for my app, all changes get here.

I encountered a bug, I would receive an attachment in email, but that attachment was still base64 encoded. The docs of genstmp / mimemail don't show it very well, but Content-Transfer-Encoding is not meant to be within "content-type-params", so resulting headers are:

Content-Type: application/x-apple-aspen-config; Content-Transfer-Encoding=base64

instead of: (notice indentation, and parametrization with =)

Content-Type: application/x-apple-aspen-config Content-Transfer-Encoding: base64

kamilc commented 9 years ago

@dejanstrbac This looks great - Thank you so much!

Re: mime types - yeah we need a much longer list of course. I love the "default" type solution though.a

dejanstrbac commented 9 years ago

@kamilc Thanks for merging. However, I am still seeing an issue here, even though the headers are right now for the content type, somehow the file doesn't get decoded right in the email client. Before my PR, the file would simply download as still base64 encoded, while now it seems gen_smtp doesnt encode it right. Expect and update and a test for this.

Cheers

dejanstrbac commented 9 years ago

@kamilc Solved with #19 Confirmed it works :+1: