Embedding attached images in HTML emails

Be more specific on how you build the HTML mail message.

The result will be a multipart-MIME message with a text/html part (if you really do it right with an alternate part of type text/plain) and several images, which are then referenced from within the HTML.

See RFC 1813 and RFC 2378 for more information about content-id in mixed MIME and related data (referred by CID in the HTML source).


The image attachment section needs Content-ID

--T4nu9J8b
Content-Type: image/png
Content-ID: <idname>
Content-Transfer-Encoding: base64
Content-Disposition: attachment ;filename="testimage.png"

iVBORw0KGgoAAAANS...
--T4nu9J8b--

Note: Content-ID name should be put in an angular bracket, as given

Embed it into the tag using same Content-ID (without the angular bracket)

<img alt="Embedded Image" src="cid:idname"/>

This should allow the attached image to be displayed into the HTML!

Tags:

Email

Mime