The validator will display errors for all types of standard tags and elements (TD, TR, TABLE, DIV, A, STRONG, etc.) All HTML elements should have an appropriate closing tag to be considered valid, and having valid (and properly nested) closing tags are critically important with HTML email.However, there are a handful of elements that are considered empty elements or self-closing tags (namely BR and IMG in email).
If your messaging platform or ESP uses specialty tags or proprietary scripting, these will also trigger validation warnings that appear as “Element x undefined.” For example, Campaign Monitor uses the tags to indicate where the unsubscribe link should appear in your email.
The problem with using DOCTYPE with email is that some clients strip out the DOCTYPE or apply their own.
If you don’t include a DOCTYPE in your HTML file, the W3C validator will use the HTML 4.01 Transitional Document Type. Generally speaking, I recommend using the HTML 4.01 Transitional or XHTML 1.0 Transitional when validating HTML for email.
Chances are you’ll have to ignore these warnings in order for your email to work properly after it’s been sent from your provider.
Keep in mind that errors can cascade, meaning that one error at the beginning of your HTML may trigger more further down the document.
There are several types of messages that are generally safe to ignore.
A common error you might see is “there is no attribute BACKGROUND.” While BACKGROUND is a perfectly valid element for using background images in an email (and the only way to ensure background images display in Gmail), it’s considered a “deprecated” element and thus invalid under certain specifications.
Examples of these errors are “end tag for TABLE omitted,” “end tag for element A which is not open,” or “end tag for P which is not finished.” These are critical, but easy to fix.
The validator should indicate the line of code in your HTML that the error was found, so you can easily locate and fix the problem.
Litmus’ comprehensive spam checking service also uses the W3C validator and reports back the warnings that the validator returns: Since most email clients don’t follow web standards and there are no email-specific standards in place, this means that validating the HTML you’ve written specifically for email can be tricky business.
Due to these variances in HTML support for some email clients, you might find yourself using hacks, deprecated elements or unstandardized code to get your design rendering correctly.
Validating HTML for email can be tricky–read on for our how-to guide.