Step 4: Code for Google Mail, Lotus Notes and Outlook 2007
Google Mail, Lotus Notes, and Outlook 2007 present their own unique coding challenges. Outlook 2007, believe it or not, has significantly less support for CSS than previous versions of Outlook!
Google Mail’s lack of support is a little more forgiveable — because the application runs in a browser, it cannot control the contents of the emails it displays. Consequently, Google’s engineers have had to take steps to ensure that their application displays properly regardless of the quality of the HTML or CSS in which emails are written.
As a result, Google Mail is a new web mail service that acts like an artifact of the early 1990s, when web standards were primitive. It takes some work, but it is possible to crack open a Google Mail page and see just how convoluted the services approach to rendering HTML email actually is.
For one thing, Google Mail deletes the CSS styles contained between any style tags, no matter where they appear in the email. And fonts displayed within HTML tables — the only alternative to using styles — have the odd habit of appearing larger than intended, no matter how the HTML email is structured.
The good news, however, is that if you code to account for the oddities of these email three applications, your HTML email code is more likely to display well in most, if not all, email clients. Here are some techniques that appear to work well in Google Mail and other older email software:
- Define the background color in a
tdcell with the
bgcolorattribute, not the CSS style.
- As noted above, use the
backgroundattribute in the
tdcell for background images instead of using CSS. One side-effect of this approach is that the background image can be made as tall as needed — if the content used in your email template is likely to vary in size, using an extra-tall background image in this way allows the height of the email shrink or expand, depending on the height of the copy, from one email to the next. Remember, though, that Outlook 2007 ignores background images completely.
- If it works better, use the padding declaration to control margins within a td cell. The margin style does not work in these cells, but padding does.
- If you need a border around a
tdcell, keep in mind that Google Mail displays a border around a
tdcell when it’s defined in a
div, but not when it’s defined as a border style in a
- If you need a light-colored link against a dark background color, put the font definition in the
tdcell (so it applies to
atags equally) then add a
color:style to the a tag.
- If the
afonts appear to be different sizes, wrap the
atag in a
- Google Mail aggressively uses the right-hand column of the Google Mail user interface, which squeezes the HTML email into the center panel. Be sure the padding style in the content tds is set to 10 pixels all round, so that text does not hit against the left and right edges.
- When testing an HTML email with a Google Mail account, it’s likely that you’ll find that one or more font styles are missing in the
a, and other tags. Inspect every font carefully to make sure Google Mail displays the fonts correctly.
Besides Google Mail, there’s another, less obvious hazard a programmer faces when creating HTML email: Lotus Notes. Many large corporations continue to support and upgrade their Notes installations (as of 2004, IBM reported that 95 million people used Notes).
Unfortunately, it’s impossible to tell which companies use Notes. The best approach is to follow the guidelines described in this article — the more primitive the code, the more likely it will work well, if not perfectly, with Notes.
That said, it’s quite possible that Notes will introduce to your HTML email quirks that are almost beyond belief. For example, the software can convert images to their proprietary formats, or simply ignore flawless basic HTML in one email, but display other HTML fine in another email.
A trial version of Lotus Notes is available for download if you need to test your mail in Notes — see the resource list at the end of the article. Here are a few tips that will help you convince Notes to display your HTML email properly:
- As we discussed previously, use a container table that contains all the internal layout tables (for example, for the header, content, and footer). This keeps the email together in one chunk of HTML, so pieces of the layout are less likely to wander when displayed in Notes.
- Create a gutter around the container table by setting the width to a percentage and/or using a cellpadding of at least 5.
- As I mentioned earlier, avoid using a
styledeclaration in your email’s
headtag. It might be the approach that adheres to web standards, but Notes (like Google Mail) might delete your styles. Rely, instead, on inline styles within the
a, and other tags.
- Use absolute URLs to images stored on a web server. You can’t do much about Notes converting images, but using remote images might help.
- Intra-email links, using named anchors, rarely (if ever) work in Notes. It’s simply best to avoid links that jump down the email to a specific piece of content.
colspans in your HTML tables. Notes — especially its earlier versions — can deal only with basic table layouts.
- Be sure that your
tdcell widths are accurate. Unlike web browsers, which automatically set all cells to the widest-defined width, Notes sizes each
tdcell based on its defined width.
- Centering an email layout usually won’t work in Notes. Email layouts generally have to be left-aligned.
Using these techniques to achieve a successful render in Google Mail and Lotus Notes will ensure that your emails also display fine in Outlook 2007, which uses an older HTML rendering engine. Microsoft has published details about what their email software will and won’t display properly; more details can be found in the Resources section at the end of this article).
The Email Standards Project has additional details on CSS support in Outlook 2007, and Microsoft is one of the companies at which their lobbying efforts are targeted.
Many people who receive email prefer HTML over text for a number of reasons. For programmers, though, the task of creating an HTML email that will display consistently appears both simple and horribly complex. This article has described many of the issues and strategies for creating markup that will work across email software.
What’s the best idea to take away from this article? If there’s a choice to be made between a simple email design and a more complex solution, simplicity is always the safest bet.
These resources offer valuable information that will help you if you want to learn more about coding HTML email.
Email Standards Project
The Email Standards Project is probably the best starting point for understanding exactly to what degree HTML and CSS are supported by different email clients. The site also maintain an acid test that can be used to compare compliance across email software, and there are several ways in which you can participate to help improve email support of web standards.
Free HTML Email Templates from Campaign Monitor and MailChimp
Both of these email delivery services actively test their templates over time with different email clients. However, there are subtle differences in the approach that each takes — Campaign Monitor places a
style declaration within the
head tag, while MailChimp does not. Be sure to test your final HTML code with whatever email clients are used by recipients of your email list.
Plain Text Email Design Guidelines
This article lists a number of simple techniques for making text emails easier to scan.
Testing HTML Email
From SitePoint’s sister site DesignFestival.com , this article explores testing procedures across multiple email clients. Other related articles on DesignFestival include creating HTML email layouts and understanding multivariate testing.
Articles about Blocked Email Images by ClickZ and Campaign Monitor
From 2004, the ClickZ article shows how major email software compares when images are blocked or when the content is viewed in a preview pane. The Campaign Monitor article goes into greater detail, listing actual examples and ideas how to combat default image-off rendering of your emails, as well as designing your email to look okay in preview panes.
Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007
The official Microsoft description of what Outlook 2007 will and will not render for HTML and CSS. Includes a link to a validator that works in Dreamweaver, as well as Microsoft editing tools.
HTML Email Tips for Web Designers
A useful, barebones list of guidelines for creating and sending email. The free email templates also are great samples to study, because the code is heavily commented and has been tested against a broad range of email software. And, finally, the Resources page includes some great links to best practices, as well as other resources.
MailChimp Email HTML Coding/Delivery Guide
Lots of great information about all aspects of HTML email, including how spam filters work.
CSS Support in HTML Emails of Hotmail, Yahoo! Mail, and Gmail by Xavier Frenette
This is excellent research that shows style-by-style results for how these three webmail services display CSS.
A Guide to CSS Support in Email
Campaign Monitor, an email service provider, has taken Xavier Frenette’s excellent work documenting CSS performance in a few email clients and expanded it to include Gmail, Hotmail, Yahoo!, and Windows Live Mail. It also covers Outlook 2003, Outlook Express, Lotus Notes, and Thunderbird on the PC, as well as Mail, Entourage, and Eudora for the Mac.
The “Secrets of HTML Email” Series
Some of this information is old but a good piece on Lotus Notes is offered.
Lotus Notes Trial Software
This page offers free downloads of the latest Lotus software, which is handy if you need to test an email with the Notes client software.
Email/Web Testing Services: BrowserCam and Litmus
These are both excellent services for testing how compatible your web pages with a variety of web browsers and operating systems. For email, Browsercam simply shows you all the warts in your HTML code, even though your email might work fine in Notes, Google Mail, and other difficult email software environments. Litmus shows how your email appears in a variety of email clients.
This decent, free online service tells you about the “spamminess” of your email. You also should look for an email delivery service that provides this sort of spam check.
CSS and Email, Kissing in a Tree
This excellent CSS-only approach to HTML email was published by A List Apart. NOTE: The author has written an update to this article, posted at the Campaign Monitor blog, Optimizing CSS presentation in HTML emails.
How HTML Code Affects E-Mail Deliverability
A decent overview that describes how different email services view the HTML you include in an HTML email. You can’t address every problem directly (for example, creating a clear boundary between the HTML and text versions of your email is a problem for your email service provider, if you use one) but it helps to know what happens.
Standalone Internet Explorer 6 Web Browser
This free software allows you to install and run IE6 and IE7 in parallel, without causing conflicts.
Go to page: 1 | 2 | 3
And if you enjoyed reading this post, you’ll love Learnable; the place to learn fresh skills and techniques from the masters. Members get instant access to all of SitePoint’s ebooks and interactive online courses, like Create Stunning HTML Email That Just Works!.
Comments on this article are closed. Have a question about HTML email? Why not ask it on our forums?