I’m using System.Net.Mail to send an email message and want to make sure it appears properly from anything from a text-only cellphone to a rich client on Mac, Suse Linux/Evolution, or Windows.
I gather there are a few points to consider when sending a message with such a broad reach. Here is my list so far:
Plain text header: For text only clients, preface the entire message with plain text that says “to view this message click this link”. This text should be readable even if the message hits the spam folder.
Layout: For the html portion of the message, should I use CSS or HTML Tables?
Doctype: What is the proper doctype to use XHTML, HTML5?
Images: What is the best image format to use? .. should I take any special considerations when embedding it? I’d prefer for the existence of an image to not give the message an “attachment” icon
MIME types: Is there any special MIME type I should use for the plain text or html part… or should I just preface the HTML with my text, and then hide that text with CSS style?
I’m sure there are more things to consider, or ways to rethink the above. What other items should I keep in mind when generating such an email that needs to understood by many devices?
This guide to css support is invaluable. In general, write your html like it’s the year 2000. You’ll be using a lot of tables for layout. CSS support is decent, but you have to use inline styles. That’s because gmail strips styles in the header and no mail client links to external style sheets. The referenced guide does a great job of explaining all the guidelines.
As far as html and text, the best practice is to send them both. You do this by adding an alternate text view. See this article for an example. There are many such tutorials if you google “send html and text with .NET” or something similar.