Pylons / pyramid_mailer

A package for sending email from your Pyramid application
https://docs.pylonsproject.org/projects/pyramid-mailer/en/latest/
Other
50 stars 40 forks source link

No multipart/related Content-Type for inline images #74

Open gregality opened 8 years ago

gregality commented 8 years ago

Hi, I'm currently trying to embed an image in an email using the CID approach. The latest code on the master branch has support for setting the Content-ID, but it doesn't also set the MIME part to "related" (it sets it to "mixed").

In testing, some email clients, notably Gmail and Thunderbird, won't display the images in-line unless the MIME type is set to "related", while other clients (Outlook, Yahoo) will display the images in-line.

Is there a reason why the MIME type is hard-coded to 'mixed'?

See Issue #57 where the MIME spec's are referenced. Also, these stackoverflow posts are helpful:

http://stackoverflow.com/questions/3902455/smtp-multipart-alternative-vs-multipart-mixed

http://stackoverflow.com/questions/19497672/multipart-messages-including-multiple-attachments-attachment-and-inline-wi

Thanks!

oscarmlage commented 3 years ago

I've hardcoded a multipart/related string here instead multipart/mixed in order to test it and it seems it works (at least in Thunderbird and Gmail). OTOH it screw up things a bit in Apple Mail (iOS/iPad): if you're sending some real attachments in the email, not only the CID images, Apple Mail detects that there are attachments but you're not able to download them.

I guess the attachments needs to be sent with the proper Content-Type:

My 2 cents.