Ecommerce and Entrepreneurship Blog | About | Contact | Store

Gmail Considered Harmful

Posted on March 23, 2010 by Trevor

As a developer, it's my job to figure out solutions to other people's problems. So most of the time I don't bother getting annoyed at problems I run across: at least it's a kind of job security! But sometimes there is no good solution to a problem other than to get annoyed and try to make enough of a fuss that somebody does something about it. Sometimes it takes a good old-fashioned rant.

Email. We all get it. From our grandmother's forwards to memos from work to the spam we quickly delete. Hundreds of billions of messages are sent every day to one out of every five people worldwide (out of the entire population; only one in four even has internet access). Obviously, as one of the longest-lasting and most important uses of the internet, a lot of work has gone into both email itself and the technologies surrounding it. Email has gone from simple text with cryptic headers read on a command line to requiring full-fledged multimedia support. One of the most exciting developments has been its transition to web standards.

Early Email Formats

Originally, email was simple text, it got the message across, but any formatting had to be done externally- perhaps sent as an attached word processing document. As technology developed, people wanted to be able to format the contents of their emails themselves, and clients developed various schemes for encoding content other than ASCII text in messages. However, this was quickly remedied as MIME types were established that allowed emails to be sent in many different formats, the most popular of which was HTML. Since then, as HTML and its related standards have progressed, so has email. The ability to format an email as you would a web page has proved vital especially to business communications. One of the primary functions of email clients is to support this formatting and display the email as the sender intended it.

Google's Gmail Behind the Times

However, there is a hitch, and this time it comes from a surprising angle: one of the largest, most standards-compliant companies out there, Google! Google's web-based email client, Gmail, is justifiably popular especially among the tech crowd, but it breaks html email standards in a very annoying manner. I've talked before about web standards and difficulties in keeping them straight among the profusion of browsers. Throw email clients into the mix and you're practically lost. However, Gmail is the big offender, because of the way it handles CSS.

CSS comes in several flavors. You can use "inline" CSS, putting your formatting directly on the elements you wish to format. You can place it in between "<style>" tags, keeping it in the same document but consolidating it into one section. You can also put it in one or more separate documents and link to it. Web developers often prefer the latter, because it allows them to keep the CSS formatting separate from the contents of the site, and makes it easier to edit. However, Gmail doesn't support separate CSS documents. It doesn't even support the "<style>" tag. It ONLY supports inline CSS (and actually, it doesn't support every aspect of that). Why is that a problem? Let me demonstrate. Here is an ordinary piece of code:

h1 { text-align: center; font-size: 3em; font-weight: bold; }
#intro { margin: 1em 0; text-indent 2em; }
.brands { display: block; margin-left: 5em; }
.brands li { list-style-type: none; font-weight: bold; }

<h1>PlumberSurplus Faucets</h1>

<p id="intro">PlumberSurplus provides high-quality faucets at great prices!</p>

<ul class="brands">

As you can see, the CSS is packed inside the "<style>" tags, making both it and the html below easy to read. However, in order to get the same effect in emails viewed with Gmail, that same code would have to look like this:

<h1 style="text-align: center; font-size: 3em; font-weight: bold;">PlumberSurplus Faucets</h1>

<p id="intro" style="margin: 1em 0; text-indent 2em;">PlumberSurplus provides high-quality faucets at great prices!</p>

<ul class="brands" style="display: block; margin-left: 5em;">
    <li style="list-style-type: none; font-weight: bold;">Kohler</li>
    <li style="list-style-type: none; font-weight: bold;">Moen</li>
    <li style="list-style-type: none; font-weight: bold;">Delta</li>

Not only does that make it harder to read and to separate the format from the content, but it also makes it longer and harder to write: look at how the style on the "<li>" tags must be repeated for each of them. That means if I needed to change the way they were formatted, instead of just changing it in one place, I'd have to look throughout the entire document. So inline CSS makes emails larger, harder to write, and more error-prone.

Well, you say, maybe Gmail has good reasons for restricting CSS. After all, we don't want untrusted code having control over our computers. But the thing is, there's no such danger with CSS. It's built strictly as a formatting language: there are few if any possibilities of compromising systems using CSS, and none that depend on separating it out rather than using inline. That choice is primarily a developer convenience, unnoticed by the user. Furthermore, out of the top email clients, Gmail is the ONLY client not to allow some kind of separation of CSS. Over 75% of email clients have this capability with no problems; why can't Gmail? Even if Gmail is concerned with email CSS interfering with the format of their client (since, being a web interface, it too uses CSS), that is easily prevented with sandboxing and checks at the individual tag level: other webmail clients have managed for years without having to put a blanket prohibition on separated CSS.

Gmail, your refusal to bring your standards up to date is a major hassle for developers! You are the only major email client who is so abysmally behind, in marked contrast to other aspects of your company and Gmail itself. I know you can figure this out: please, get with the times. Make developers happy that they don't have to jump through hoops, and make your users happy that their emails aren't broken.

The possibilities are endless with a bathroom remodel. Discover your classic side with a clawfoot tub, experiment with fresh bathroom vanities and coordinate it all with matching faucets. Shop 24 hours a day, 7 days a week for all of your bathroom needs.

blog comments powered by Disqus