Skip to content
pzb edited this page Apr 17, 2011 · 3 revisions

When creating HTML for sending via email, you should do a few things. This is not written in stone

The real requirements

  1. Make sure your page is valid HTML
  2. Include a DOCTYPE declaration
  3. Make sure that all the characters in the HTML file are valid for the character set. A HTML validator will flag character errors for you.

Things I recommend

  1. Do not include any Javascript (the email client will not run it). This includes:
    • script elements (<script>)
    • handler attributes (onblah=)
    • script URIs (src="javascript:)
    • scripting in styles (behavior, -moz-binding, and expression)
  2. Inline all styles. Some mail clients, notably Google's GMail and Blackberry, do not support style sheets. So use the style attribute on elements rather than the style element.
  3. Set height and width on all img elements. A number of mail clients do not load external images by default, so set the width and height to make sure the rest of the email is laid out correctly.
  4. Do not use objects in email (that includes Java applets, ActiveX controls, and Adobe Flash SWF). Just avoid the embed, object, and applet elements. Also avoid the HTML5 video and audio elements.
  5. Use character entity references rather than numeric character references. That is, use &amp; not &#38; or &#x26;.
  6. Don't use references where not necessary. &#97; is the same as a. Just use a.
  7. Don't use forms. Instead include a link to a page on your website with the form.
  8. Do not use framesets. Avoid the frameset, frame, and noframes elements.

http://www.campaignmonitor.com/resources/category-archive/cat/designing-and-building-emails/ has more information on email client capabilities.