For a change of pace, the code in this CodeSOD isn’t the real WTF. Our Anonymous submitter works for a company that handles meeting scheduling for corporate customers. This entails shipping off loads of HTML-emails, and that means using a relatively terrible WYSIWYG editor that generates code like this:
<p class="MsoNormal"><strong style="color: #003877;">Meals</strong></p>
<p class="MsoNoSpacing">
<span style="font-size:9.0pt;font-family:" verdana",sans-serif;="" mso-fareast-language:en-gb"="">
All breakfasts and lunches will be served in Food Capital on the ground floor of the hotel.
</span></p>
<p class="MsoNoSpacing"><span style="font-size:9.0pt;font-family:" verdana",sans-serif;="" mso-fareast-language:en-gb"="">
We look forward to hosting you for the following dinners:
<o:p></o:p></span></p>
Yes, awful, but no worse than any other WYSIWYG email editor, right? Well, take a look at this particular sample:
<p class="MsoNoSpacing">
<span style="font-size:9.0pt;font-family:" verdana",sans-serif;="" mso-fareast-language:en-gb"="">Dietary Requirements: </span>
<!--[if supportFields]>
<span style='font-size:9.0pt;font-family:"Verdana",sans-serif;mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:Arial;mso-fareast-language:EN-GB; mso-bidi-font-weight:bold'>
<span style='mso-element:field-begin'></span>
<span style='mso-spacerun:yes'> </span>
MERGEFIELD Dietary_Requirements
<span style='mso-element:field-separator'></span>
</span><![endif]-->
<span style="font-size:9.0pt;font-family:" verdana",sans-serif;="" mso-fareast-font-family:="" "="" times="" new="" roman";mso-bidi-font-family:arial;mso-fareast-language:en-gb;="" mso-bidi-font-weight:bold"="">
*/field1/*</span></p>
This particular block came to our submitter’s attention when they received a report that it was crashing computers. This was surprising, in part because after rigorous and thorough testing, our submitter couldn’t replicate the error.
That is, until they followed up and asked the important question: “What email client are you using?”
“Outlook,” came the reply.
Obviously, they’d already tried to replicate the error in Outlook. “Which version?”
“2007. Why, does that matter?”
As it turns out, the decade old email client really doesn’t like conditional comments- things like the <!--[if supportFields]-->
. In fact, it hates them so much, it was crashing the users’ computers.