views:

28

answers:

2

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?

A: 

This might sound trite, but if you want your email to display properly on any system, why not just send a plain-text email?

Is there some compelling feature of rich HTML that you really need?

Me, when a web site presents the option to choose text over HTML for their communications, I always choose plain text. It requires less bandwidth, is easier to read, doesn't have any obnoxious images, requires less processing power, etc etc.

If you only use the lowest common denominator, you will have the broadest device support.

That said, using multipart/alternative with a text/html part should work just fine on any reasonable device. The things not supporting HTML will display the text and the other devices will display the HTML. Use only a simple set of HTML - don't go overboard with fancy CSS features.

Borealid
+1  A: 

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.

Rob