Emailology: 5 Reasons You Should Always Validate Your HTML Code When Developing Emails
Posted November 9, 2011 by Michelle Klann
Coding errors in web pages are one thing but errors in HTML emails are an entirely different story. So why is it so much more important? Here are 5 reasons why you should always validate your HTML when developing emails.
1.) You'll be sharing center stage with web based email clients like Gmail and Hotmail
Many web clients do not make use of iframes for displaying your email. Instead, you share the web browser with their interface and often times, they will do their best to ensure there's no conflict. That said, their interface often comes equip with lots of embedded styles, container elements (ie DIVs) and fancy client side scripts for displaying banners or cropping off a portion your beautiful email design.
2.) A random "</div>" can stick a wrench in Gmail and Hotmail
DIV's can be easy to mess up, especially if you have several nested so let's say you accidentally leave an extra </div> somewhere in your code... This will inadvertently close one of Gmail or Hotmail's UI div's and that can leave a big mark, especially if it's in the middle of your email design.
3.) Desktop email clients render errors differently
Each desktop email client uses a specific rendering engine. Unfortunately each rendering engine handles coding errors differently and some are more lenient than others. With that in mind, it's always best to test your email in the most popular web browsers first, then run an Acid Test to preview your email in the most popular email clients before sending.
4.) Empty TD's will get their fill from Gmail
Gmail doesn't like empty table cells so if you are trying to achieve a 1px space, you might get unexpected results. For example, this:
Will get converted to this:
5.) If you have random elements in your tables, Gmail will try to fill in the blanks
Let's say you have content that should be inside a table cell:
Gmail will wrap your random content inside table rows:
If you have more than one cell, it still renders only one new table row. For example:
Is converted to this:
If you have random text inside the TR but not in the TD Gmail will create a new TD. For example this:
Is converted to:
When you submit your email through our testing tool, the first thing we do is check for validation errors. This error report is based on your DOCTYPE. If we find anything, you can cancel out of the test, correct the issues, and re-run your email without charge.