Issue with inline images #25

bigal488 opened this Issue Mar 23, 2012 · 4 comments


None yet
2 participants

Its great that emailjs supports inline images:
..but I'm seeing some strange behaviour: The inline images appear twice in my mail reader (Os X Mail app) Once inline and then again as an attachment.

Tried a different reader (Google Mail) but there the image doesn't appear inline and just shows up as an attachment.

I'm wondering if this is because the attached inline image should be inside the boundary for the HTML content of the message?

A bit of juggling around with the boundaries shows that another level of boundary nesting with Content-Type: multipart/related needs to be introduced to get inline images to display properly. The nested level contains the encoded html and the image.

something like this:

Content-Type: multipart/mixed; boundary="masterboundary"

Content-Type: multipart/alternative; boundary="partboundary"

Content-Type:text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Plain text here

Content-Type: multipart/related; boundary="subpartboundary"

content-type: text/html; charset=utf-8
content-transfer-encoding: base64
content-disposition: inline


content-type: image/png
content-transfer-encoding: base64
content-disposition: inline; filename=renamed.png






eleith commented Mar 25, 2012

thanks @bigal488 for looking into this.

i'll push a fix through in the next week or so.


eleith commented Mar 27, 2012

@bigal488 i have pushed a branch called 'fix-inline-images'

basically, i added support for 'multipart/related'. can you please test it to see if this fixes this issue for you on the mail clients you are testing on?

you can see in test/test.js how to attach related attachments...

Nice! fact really nice!! It works perfectly and I think having an array of related attachments inside the message.attach object is a great idea.
Many thanks for getting this resolved so quickly.

bigal488 closed this Mar 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment