Continuation > Collapsible Email

by Developer @ pebbl.co.uk on Saturday, 24 September 2011

I didn't quite get round to finishing my original post about this, it was just at that time that work went a little hectic, and I don't think I've properly stopped since.


Anyways at the time the information was fresh in my memory, it's gone a little stale now unfortunately. I remember there were quite a few things I wanted to write about, so if I do get some spare time (and a reason to look in to it) I'll pick up my collapsible email template again. Before I consign this to the "most probably never" however, there are a few things that I can remember that may help out other people trying to get around particular mail agent inconsistencies.


Outlook 2007/2010


Next to Lotus Notes, Outlook 2007 is almost fun... but compared to the other e-mail clients, it is quite simply a joke. Annoyingly it is a joke that is installed on a large number of machines worldwide. So as per usual, us developers have to find some way of limping on with awful software. In case it helps, here are a few nice style properties, that affect only microsoft products.


mso-hide

If you need to hide a particular element only in Outlook 2007/2010 use the following inline style.


style="mso-hide: all;"

It should work just like display:none; but is Microsoft specific. I've mainly used this on items that really are already hidden, but in some cases their presence still creates padding or spacing issues for Outlook.


mso-table-lspace and rspace

Whilst trying to get my collapsible email to layout nicely I kept getting annoying horizontal spacing appearing between tables in Outlook. Eventually, the only way I could find out what was actually causing it was to send my email to my Outlook 2007 account and grab the raw message content / source. Obviously for most email clients you would assume - logically - that the raw message source would be the same as the e-mail i sent out. As usual though Microsoft do their "magic" and translate the mark-up in to bloated gibberish that is barely recognisable as my original.


After poring over the source for a while I spotted two additional style properties in amongst all the nonsense things that were being dynamically generated. These were "mso-table-lspace" and "mso-table-rspace". Don't ask me why Outlook 2007 thought it prudent to add them, my only guess would be that because the HTML renderer used by OL2007 is primarily designed as a WYSIWYG interface, this extra spacing is added to allow users to click between tables and type content. This however makes no sense from the context of "viewing" an e-mail, so my assumption is that I am 100% correct... Thankfully these properties are not automatically overridden, so all I had to do was specify them on each of my tables, and set them to 0pt.


style="mso-table-lspace: 0pt; mso-table-rspace: 0pt;"

Leave your comment