HTML mail is a terrible idea — but at least please do it right

Originally email consisted just of text messages. They were straightforward to read. It was very hard to send malware in a convincing way, since the recipient would have to extract any malicious attachment and run it by hand. There was a hoax in 1994 warning of the alleged “Goodtimes virus”, which caused a lot of merriment among the computer-literate. The only “virus” was the hoax email itself, which the less computer-literate forwarded to all their friends.

Then came HTML mail, a huge advance in email insecurity. Now malicious URLs could hide behind links or even be opened automatically. It could include JavaScript to exploit client weaknesses and trick recipients. Today, almost everyone recognizes these advantages, and malware and phishing by email are multi-billion-dollar businesses.

Doing it right, or not doing it at all

Even so, there are good and bad ways to create HTML mail. More precisely, there are reasonable ways to create the text part of multipart/alternative mail. Quite a few mail clients do an awful job of it. I have Thunderbird set to display email as plain text. This means it displays the text version if possible and renders the HTML part as plain text otherwise.

The rules for creating the text part are simple: Create readable text, preserving line breaks. Making HTML links available in some form is helpful but not absolutely required. That shouldn’t be hard to do. If you can’t do even that much, then don’t include a text part at all; most mail clients that handle plain text mail will do an adequate job of rendering the HTML as text. That means that if you don’t feel like doing the text part properly, you can leave it out, and usually the recipient will get something readable. Leaving it out is better than doing it badly.

Some of the awful treatments of the text part which I’ve encountered include:

  • Making attachments available only if you view the message as HTML. In fact, this post was inspired by a repeat of a message which I got a year ago which hid the attachment when viewing the message as text. Apple’s iCloud email is still broken a year later.
  • Turning all the HTML markup into text, with every <p> and <div> showing with the angle brackets. A condo newsletter which I was getting before I sold the place did this. I suppose the creator of that software thought I should format the mail in my head.
  • Including a blank text part. Leaving the text part out isn’t the same as creating a text part and putting nothing into it. A blank text part renders as a blank message.
  • Leaving out all line spacing, so I get one huge paragraph.

It’s more effort to do it badly than not to do it at all. So please, if you’re writing a mail client, don’t go out of your way to make life difficult for people who prefer to read it as text. Maybe you think I need to be converted to accepting HTML mail. I don’t, and your sending me unreadable mail certainly won’t convince me otherwise.

Comments are closed.