pyramid_mailer icon indicating copy to clipboard operation
pyramid_mailer copied to clipboard

No multipart/related Content-Type for inline images

Open gregality opened this issue 10 years ago • 1 comments

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!

gregality avatar Dec 09 '15 16:12 gregality

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:

  • CID Images: multipart/related
  • Real attachments (pdf, doc or whatever): multipart/mixed

My 2 cents.

oscarmlage avatar Jul 01 '21 12:07 oscarmlage