tags:

views:

469

answers:

2

If I attach an image to an email, how can I place it in the HTML content? I tried just using the filename as the image source but that doesn't seem to work.

+3  A: 

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).

Lucero
It is built as a multipart MIME message with html and image parts. If I'm reading these RFCs correctly, it sounds like I just need to put a content id on the image attachments and then use cid:xxx as the image source.
This is correct, if everything else is already in place in the MIME message, embedding them is easy.
Lucero
+2  A: 

If this has to do with sending emails from a website you are developing, just keep the images on your server and then link to them using the <img src="url"/>.

TheTXI
...most modern mail applications do't show those images for security reasons unless explicitly confirmed by the user. Embedding (small) images is much better in order to make sure that the message will show up as intended (or, this will be more likely).
Lucero