Code HTML Email Templates by Breaking the Rules

If you’re anything like me, the first time someone told you to make an email template, you thought, “Piece of cake!” After all, emails use HTML (or the types that needs templates do, at any rate), and HTML is a cinch, right?

As it turns out, you’d be wrong. HTML is a cinch, but the truth is, the more you know about proper HTML coding standards, the harder it is to make a functional email template. That’s because the only way to write them is to break all of those pretty rules you spent so long mastering. Here’s the breakdown:

Why are the rules set this way? I blame the proliferation of spam and the lack of standards between email clients. HTML is great, but it gives spammers too much control, and the knee-jerk response is to strip out everything until you’re left with… well, this. Don’t believe me? Try testing your email template on the dozens (probably hundreds) of email clients in use. And you thought cross-browser compatibility testing was bad…

So, blasphemy though it may be to us coding purists, these are the standards you have to keep in mind when coding email templates. As a rule of thumb, just break every rule in the book and you’ll be on the right track. And if that makes you feel dirty, you can always read a good book on HTML 5 for absolution. ;)

Comments

One Response to “Code HTML Email Templates by Breaking the Rules”

  1. Teresa on March 3rd, 2012 6:14 pm

    Even then, tables are problematic whenever there’s an image involved. Let’s say you want a standard header image with a nice border on the entire table; you drop the image into the table TD and it should look great – but it doesn’t. That’s because, depending on the email program / browser, there’s some “padding” inserted – at the top in some programs / browsers and at the bottom in others. You can’t trick things out by inserting a background color or adding a border to the image because you’ll wind up with a fat border on top or bottom of the image. Adding inline padding / margin css is useless because only some email programs / browsers render it. So I keep looking for designs that work better than what I can create.

Share Your Thoughts