HTML email with attachments

602 Views Asked by At

A friend of mine wants me to help him make a HTML email template that contains a header and footer image.

Originally I thought it would be easy enough to just create a tabular html email that used remote images inside tags for the header and footer, however most email clients will not display these images by default.

A collegue has mentioned MIME and UUEncoding, however I cannot find a clear example of how to achieve this.

Could somebody please give me a hint on how I can achieve what it is I am trying to do.

Thanks in advance

1

There are 1 best solutions below

0
On BEST ANSWER

Yes, as tripleee wrote, you have to use some library or client which understands MIME.

Include the HTML body and the referenced images in a multipart/related MIME part.

Refer the images in the HTML part using the cid protocol. For example

<img src="cid:logo">.

Here is an example MIME header for the included picture:

Content-Type: image/jpeg; name=logo.jpg 
Content-Transfer-Encoding: base64 
Content-Disposition: inline; filename=logo.jpg
Content-ID: logo