There are still some of us out there, an ever dwindling group I’m sure, who don’t want images or borders or colors or bold fonts in an E-mail. I know that using HTML markup to send fancy-pants E-mail is popular with the kids these days, I even begrudgingly support it in my own webmail client. But for the love of all that is holy, if you are going to send HTML formatted E-mails (or any other rich text format), please do it correctly – INCLUDE A TEXT VERSION.
The MIME standard, which defines the structure of “modern” E-mail messages, already supports exactly what you need: Just use “multipart/alternative”, and send a text only version along with the wiz-bang HTML copy you spent a week styling (most of which any sane client will strip out anyway). it’s not rocket science, and even though these standards are decades old, it’s surprising how many companies and services still get it wrong. In the last few weeks alone, I have run across the following:
No text part at all
This is the most common. You didn’t even try to send a text version of the content. Keep in mind, it’s not just curmudgeons like myself who won’t read your message, but people with accessibility requirements (think blind people using screen readers) are also going to have a hard time finding the content hidden in 50 nested divs. Why do you hate blind people?
HTML markup in the text part
You tried, I will give you credit for that. But you failed miserably, because now I get a text message with a bunch of raw HTML tags and useless style rules with some content buried deep within. Thanks, but no thanks.
A text part without the same content
You included a text part. It’s not raw HTML thank goodness. Sadly, it’s just a short message to click a link and read the HTML version online. I’m not going to click that link. Another common one is just an empty text part with no content at all. I appreciate your brevity! My favorite offender in this category is a major bank I do business with. They periodically send me E-mail with an HTML part and text part, yay! unfortunately, the text part is always the same. It simply reads:
Very helpful! I know LARGE BANKS have low standards for software development, but this is ridiculous.
Incorrect or missing character set
I can almost forgive you for this. You sent a text part. It has the same content as the HTML version and isn’t markup. But you used non-ASCII characters and did not include the correct character set header. The result is highly likely to render incorrectly. And you were so close to getting it right!
In conclusion, please be kind to aging oldsters like myself, and send a properly formatted text version of whatever you want me to read. Then I can write happy fun-time blog posts about rainbows instead of ranting about E-mail formats. Eh, I will probably still rant about E-mail formats, but I do like rainbows.
Reblogged this on varietyflair and commented:
I enjoyed this article and for some us who use either a mobile primarily to read emails or a small tBlet you do not want all that graphics either.
I’m a web developer. For my current project I’m creating a simple web client to go on their admin section of the site. I’m wondering how to properly render the HTML formatted emails in browser (without making some of the styles effect my admin page). Currently I’m rendering the HTML emails in a separate iframe, however this means another call to the server. Any suggestions?
How did you implement it in your webmail client?
Thanks for a bit of your time
I use HTMLPurifier to clean up the message. It’s a compromise between displaying it as it was intended, and stripping out potentially dangerous markup. For my client I disable remote images, remove style blocks, and tweak a few other things. Here is the code I’m using: https://github.com/jasonmunro/hm3/blob/master/modules/core/message_functions.php#L15
Thanks! Really appreciate the feedback. Will look into HTMLPurifier