Prevent Outlook from butchering HTML emails with MsoNormal?

I'm seeing a very frustrating issue with how Outlook 2013 is rendering a simple HTML-based table in an email. It is being totally re-written to have extra line breaks, styling, white space and superfluous code. Is there a way to prevent this, or a workaround method? Here is my test table code, about as simple as it gets:

<table>
<tr>
<td>Line 1</td>
</tr>
<tr>
<td>Line 2</td>
</tr>
</table>

On the receiving side, I look at the source code, and that table has been converted to this monstrosity:

<table class=MsoNormalTable border=0 cellpadding=0 style='mso-cellspacing:1.5pt; mso-yfti-tbllook:1184'>
<tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
<td style='padding:.75pt .75pt .75pt .75pt'>
<p class=MsoNormal><o:p>&nbsp;</o:p></p>
<p class=MsoNormal><o:p>&nbsp;</o:p></p>
<p class=MsoNormal>Line 1</p>
<p class=MsoNormal><br>
<br style='mso-special-character:line-break'>
<![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
<![endif]></p>
</td>
</tr>
<tr style='mso-yfti-irow:1;mso-yfti-lastrow:yes'>
<td style='padding:.75pt .75pt .75pt .75pt'>
<p class=MsoNormal><o:p>&nbsp;</o:p></p>
<p class=MsoNormal>Line 2</p>
<p class=MsoNormal><br>
<br style='mso-special-character:line-break'>
<![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
<![endif]></p>
</td>
</tr>
</table>

It looks absolutely terrible when displayed in the email. From my understanding this issue is created by how MS incorrectly renders HTML emails using the horrendous MS Word HTML back-end instead of using a real web renderer. This is for an automated alert email template for a task at my work, so changing mail providers is not an option, I am required to use MS Outlook and Exchange.


  • Edited by Beardsly Tuesday, June 02, 2015 7:51 PM
June 2nd, 2015 5:57pm

While the underlying code may not be optimal, what is the actual rendering issue for you?

Word uses CSS for styling hence everything gets a class and therefor gets wrapped in paragraphs. Your original table is without formatting but your default email template isn't and therefor the table inherits this formatting upon sending. The used formatting rules are then included upon sending and the ones that aren't used are removed.

You can basically compare this with a CSS-reset to prevent that the default browser settings result in a difference in the intended formatting/rendering but this time depending on which mail client it gets opened with.

You should be fine most of the time when you stick to HTML 4.01 and style the table via HTML 4 attributes inline instead of relying on CSS. When you do need to use CSS, stick to the CSS 1 standard. Word/Outlook will then (most of the time) apply that formatting instead of applying its own defaults. The underlying HTML and CSS will still make you cringe but the visual result should be good enough for email.

To find out which attributes and which CSS you can use for styling see:
http://msdn2.microsoft.com/en-us/library/aa338201.aspx

Free Windows Admin Tool Kit Click here and download it now
June 3rd, 2015 4:16pm

I too am experiencing this issue. I have some automated html emails going out that when they are received look terrible as extra html gets embedded without my control or request.

The 2 current replies do not address the issue. The issue is not with Outlook failing to render an html mail correctly, it is with Outlook adding extra lines embedded within the html, including unwanted linbreaks because it inserted unwanted <br> tags...why would they do this?

So in the example above, after 'line 2' there are now up to 3 <br> tags inserted meaning the table cell will wrap over 3 lines! Not the required layout by the sender.

Regardless of whether Outlook uses word or not, why is it inserting extra line break tags within the simple table?

Is there a way of getting Outlook to send/receive this type of email without butchering the original html text?

September 9th, 2015 7:12pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics