Friday, April 25, 2008

Sending HTML Email

Earlier this week, I wrapped up an HTML-formatted newsletter project. It was challenging because every email reader renders HTML slightly differently.


Also, the type of HTML that works in email differs from what's typically written for the web. Here are some of the big differences:


  • Images displayed in HTML email are stored on a webserver and read remotely by the message recipient. That means files paths to the images have to absolute paths, like a link to an external website.

  • CSS (Cascading Style Sheets) works differently, too. Usually, CSS files are external to a page, but inline styles are needed for HTML email.

  • Also, only a limited set of CSS selectors work reliably in HTML email. Margins, padding, and other positioning settings fail. Unfortunately, this means arranging elements of the page has to be done the old-fashioned way -- with HTML tables.

The biggest lesson I learned is that even a simply formatted HTML-email template like this one requires a lot of testing.