Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to send html/image email?

Tags:

html

email

Do you attach the images?

Use absolute urls?

How do you best avoid getting flagged as spam?

like image 614
mk. Avatar asked Sep 04 '08 19:09

mk.


3 Answers

One of the biggest causes, that I have found, for email to be flagged as spam is DNS. Make sure the domain / MX records from which you are sending the email actually resolve correctly back from the server used for sending.

As for images, you could attach them, but the most common way is to host them and use absolute urls. Primarily this is a bandwidth issue - you have to figure you're going to get an open rate of 10 - 15%: if you have to attach all the assets to every email, 85% of the bandwidth you'll use will be wasted.

like image 94
Ian Avatar answered Oct 10 '22 11:10

Ian


You attach the emails then reference them in your HTML like so:

<img src="cid:imagefilename.jpg" />

Outlook, at least, recognizes this as a reference to an attached image and dumps it in appropriately.

like image 39
EndangeredMassa Avatar answered Oct 10 '22 12:10

EndangeredMassa


You'll want to use absolute URLs to link out to images on a server. Users won't want to download your attachments. Also most email clients will not displays images by default, so it's a good idea to keep the really important content as text.

Email clients generally all use very different rendering methods. For example, Outlook 2007 uses Word's HTML rendering engine, whereas previous versions used Internet Explorer.

Do be aware that CSS support is also very limited to in emails. Most clients, especially web mail, will strip out everything outside of the <body> tag, as well as <style> tags. This means that external or embedded CSS will not work, and that inline styles are the safest bet (the style="" attribute). There is also poor support for many CSS rules in Outlook 2007. This means that a lot people have returned to using tables for laying out email.

As it was pointed out, Campaign Monitor is an excellent resource, and I especially recommend their CSS Compatibility Chart

like image 5
Bryan M. Avatar answered Oct 10 '22 11:10

Bryan M.