16 Tips for Troubleshooting Your HTML Email

Coding HTML for email can be tough. If you’ve missed even just a closing tag when coding, your entire email can be sabotaged. If you’ve included video, Flash, rollovers, JavaScript or even a simple picture or text, chances are it won’t show up the way you wanted it to—that is, if it even shows up at all.

Some common problems are:

  • Syntax issues: improperly nested tables or missing tags
  • Images aren’t showing up the way you wanted them to
  • Fonts aren’t displaying correctly

In this infographic, we’ve included solutions for these common problems, as well as tips to make your coding job a success.

If you’re stuck on an HTML email bug, check out Interactive Testing, which allows you interact directly with email clients to test, troubleshoot, and preview changes to your HTML in real-time. You can go way beyond static screenshots to preview things like animation, hover effects and video.

Click on the graphic for an enlarged view. The entire text of the graphic is also available below.

Code Therapy: Troubleshooting HTML Email

CODE THERAPY

Identifying What Went Wrong When Coding Your HTML Email

The problem with coding email is that just one miniscule misstep has the potential to derail an otherwise perfectly executed email. To help you correctly identify the culprit sabotaging your project, we have outlined some common problems and solutions, along with tips to make your coding job a success.

Common Problems:

Images Aren’t Showing Up

There are a variety of reasons why images might not display as you’d expect.

  1. Stuff Just Doesn’t Work the way it does in your browser. Video, Flash, rollovers, JavaScript, or even simple surveys have limited support in email.
  2. Text On Top Of An Image: Background images aren’t supported in Outlook versions 2007 and later. Avoid using background images, or try using a background color as a backup for when background images won’t display.
  3. Links and Hosting: Images need to be hosted on a publicly accessible server and referenced absolutely by your HTML in order to display properly.
  4. Blue Borders Around Images: Blue borders can pop up around images that also include a link. Ban blue borders by using a little CSS: <img src=“http://www.esp.com/images/logo.gif” style=“border-style: none;”>
  5. File Formats: Some email programs are picky about the type of image file you’re using. If you’ve used a PNG, BMP, or TIF file, try replacing it with GIF or JPEG instead.
  6. Image Blocking: Over half of email programs disable images automatically until the user clicks “show images.” There’s unfortunately no way around this; although you can ask subscribers to add you to their address book so that images in your emails are turned on all the time.
  7. Gaps Under Images: These gaps can be especially apparent in designs where the layout consists of several images sliced apart and pieced back together in a table-based design. There’s an easy fix: just add a little bit of inline CSS to each of the troublesome images: <img src=“http://www.esp.com/images/logo.gif” style=“display: block;”>
  8. Fonts Aren’t Displaying Correctly: If text is showing up in a font you didn’t expect, this is usually for one of two reasons: 1) The font you’ve specified isn’t installed on the computer used to view the email. For reliable results, use web-safe fonts, such as: Arial, Verdana, Georgia, Times New Roman, Tahoma, and Trebuchet.  These fonts come installed automatically on most computers. 2) If fonts were specified in the <head> of your email in CSS rules, Gmail will strip them out. The best solution is to move all your font styling inline.

Still Having Trouble?

Troubleshooting HTML: Use the tips below to troubleshoot your coding step by step.

  1. Override Default Settings: Some email programs and browsers have their own ideas regarding how specific elements should be displayed. Be sure that you include values (even if they’re “0”) for table cellpadding, cellspacing, image borders, etc. Explicitly stating font colors, sizes and faces can also prevent text headaches.
  2. Troubleshooting Tables: If you’re having issues with cells, columns, or rows not appearing in a table, add a border to the table to identify problems and better visualize the table structure.
  3. Isolate The Problem: Determine the source of the problem by completely removing the offending HTML and reintroducing it bit by bit. Alternatively, test the misbehaving HTML alone to see if elements elsewhere in the email may be interfering.
  4. Double-Check Your Math: If your layout is off by just a pixel or two, try adding all the table cells and making sure they equal the width of the parent table. Take caution with CSS padding and margin; some email clients include these in their “width math,” while others disregard it.
  5. Text Isn’t Aligned Properly: If you’re seeing centered text when you’d prefer it left-aligned, make sure you’ve included properties like valign and align in <td> cells and <p> tags.
  6. Spot Syntax Issues: Use the W3C’s HTML validator to spot syntax issues. The validator can let you know if there are any common errors such as missing closing tags or improper table nesting.
  7. Open Your HTML In A Browser: With tools like the Firefox Web Developer Add-On, you can disable images, hide background images, show ALT attributes, and much more.
  8. Borrow A Pair Of Eyes: It’s often hard to see our own mistakes, especially when we’ve been intensely looking at something for a while. Have someone else take a look. Perhaps it’s something as simple as a missing quote, an attribute that you misspelled, or an unclosed tag.

With countless issues that may occur while coding an HTML email, being aware of these common mishaps and quick fixes can help eliminate most of the frustrations and save time for the other fun tricks designers and coders enjoy.

Sources: KB.MAILCHIMP.COM, EMAILRESPONSIBILY.COM, LITMUS.COM

 

Subscribe to our newsletter

Get all our best stuff in your inbox, just a few times a month. We'll never share your email address and you can opt out at any time.

  • http://twitter.com/el_betun Roberto Cordella

    nice article, very complete

    • http://www.litmus.com Justine, Litmus

      Thanks, Roberto! Glad you’ve found it useful.

  • http://www.facebook.com/ericlepetit Eric Lepetit

    Also line-height seems to be a common issue as it needs to be applied only to block-level tags to make sure they render correctly in Outlook and Hotmail.

    • http://www.litmus.com Justine, Litmus

      Thanks! line-height is definitely one of those properties that behave oddly in Outlook. From what I can tell, it’s supported as long as the value is higher than the font-size?

  • http://www.litmus.com Justine, Litmus

    Thanks, Eric! Speaking of check points, have you seen http://emailchecklist.org/ ? There’s some overlap between the checks we perform there and the tips on this graphic.

    • http://www.facebook.com/ericlepetit Eric Lepetit

      Oh nice tool! Thanks for the tip.
      I just tried it and it works great. One thing though: the email I tested includes an online version and your tool says it doesn’t.

      • http://www.litmus.com Justine, Litmus

        Yes, currently the tool looks for specific/common language or ESP tags for that portion. We hope to add some breadth of functionality to it in the future!

  • Ivan Slade

    Good stuff covers most of the annoying things you would just not know about unless you have gone through the pain of figuring them out!

    • http://www.litmus.com Justine, Litmus

      Thanks, Ivan!

  • http://twitter.com/dyls dyls

    Thanks for creating this infographic, now we can fix our creative email templates =)

    • http://www.litmus.com Justine, Litmus

      That’s awesome! Glad it’s helpful!

  • Jarrod

    My most common issue with ‘text not displaying correctly’ is forgetting to re-add the font-family etc to the child table. Inheriting the basics from the parent table seems to work fine.

    • http://www.litmus.com Justine, Litmus

      Does your editor support the use of stored snippets? I have a ton of stored snippets in TextMate. This lets me use shortcuts to autocomplete commonly used elements (img tags, td cells, etc).

      • Jarrod

        I use Dreamweaver, didn’t know of anything called snippets – will investigate, thanks for the tip!

  • http://www.litmus.com Justine, Litmus

    Thanks for the tips, Mike! I don’t have much (any!) experience with Python, but it sounds like a handy tool.

    The MSDN documentation on Office is just more proof of how ridiculous it is to use Word as an HTML rendering engine!

  • cory c

    nice blog i do the html myself and then fix them with the tool from htmlforemail.com

  • bcaffrey

    Great tip! Some ESP’s will do this for you. Also, http://premailer.dialect.ca/ will do this as well without having to run a Python script.

  • http://www.venturemarketing.com/ John Fox

    does it help if all your images are hosted on a secure (https) server?

    • http://www.litmus.com Justine, Litmus

      Hi John! Some spam filters will view you in a more favorable light if your images are hosted on HTTPS, however it shouldn’t affect your rendering :-)

  • robert clan

    Nice articles on
    troubleshooting HTML based email. I appreciate your endeavor.