HTML email and Outlook 2007 summation

My journey into Office 2007 land is finally at an end. For which my client is happy, I expect. To recap, I have a modest ASP.NET (1.1) application that displays one simple webform, on which there are about two dozen TextBoxes and a dozen CheckBoxes. Users fill in some information, check or uncheck some email addresses and the send the form off to the requested email addresses.

The form is simple. There were a few formatting and required entry validators. Before I send the email, I remove a few control that aren’t needed, but other than that, it is a straightforward project. It was maddening that such an autocratic descision as to change the HTML rendering could complicate things so much (and cost my client money and inconvenience).

Here is a summary of what I had to change, how I changed it, and what I found out.

First, I found out that the only way to be sure of how Outlook would display the HTML was to install Outlook 2007. Word 2007 does not display the HTML the same way Outlook 2007 does. That alone should be enough to put the lie to the marketing fluff about user experience. And the validation tool doesn’t help at all either, since whether or not an element or attribute is supported has little to do with what the visual affect will be.

I also found out that unsupported elements are not ignored as MS states–at least not the way I define “ignore.” Input elements (ASP.NET TextBoxes, CheckBoxes, and so on are rendered as Input elements) are only ignored in so far as anything useful is concerned (say, the style attribute, or InnerHTML), but they will still render in Outlook as spaces delimited with square brackets.

In the end, I’m just glad it is a simple application, or I’d have had a nightmare. OTOH, if it was complicated I would have handled the emailed form differently. Anyway, here’s what worked for me:

  • Replace div and span elements with tables.
  • New 04/11/08: Replaced ASP.NET validators with server-side validation that registers a JavaScript alert if entries are missing.
  • Put all styles in-line.
  • Added Html label elements that pair up with TextBoxes and CheckBoxes (which render as text- and checkbox type input elements). Set display:none.
  • Before sending email, store text input element values in Html labels InnerText, and remove the input element. Store a “[X]” for checked checkboxes. (Very 1980’s.)
  • Removed Img element.

Note that in this I’ve lost the ability to have printer css styles applied, which isn’t fatal.

That’s it in a nutshell. In short, yes, I can shout an affirmation that Office 2007 sets email back five years. At least.