Genii Weblog

Lotus iNotes removing some styles/attributes it shouldn't

Mon 13 Jul 2009, 11:54 AM



by Ben Langhinrichs
Just to be clear, I am simply trying to learn about this topic, and do not currently have any iFidelity magic to make it better.  I am not even (entirely) certain that what Lotus iNotes is doing is wrong, or whether it is simply a design decision with some unfortunate ramifications.  I mentioned in one of my iFidelity posts that the:
Dojo editor seems to strip out some colors (including the "Geek" in SpamGeek), so now I have to see if I can find a work around for Dojo bugs
It turns out I was incorrect, and that it has nothing to do with Dojo (as far as I can tell), and is a problem back in 8.0, and possibly earlier (although I have not verified yet).

The issue is with MIME emails (ones with HTML) that are displayed in Lotus iNotes.  These are different than rich text emails displayed in iNotes, because in general, you might think that iNotes could simply display the HTML part and let the browser handle it.  Unfortunately, there are valid reasons for the HTML to be manipulated, especially if there are images stored in the message.  In a MIME email, an image may be referred to by URL if it is available on the Internet, or by CID (content-id) if it is stored in the message.  Since the browser would not know how to find the content-id referenced image, the HTML must be modified.  Similarly, sometimes the HTML is modified to ensure that the content doesn't sneak out of the iNotes frame, as in this LinkedIn message with a sprite:

<h3 style="background:url(http://www.linkedin.com/img/sprite/sprite_nus_digest_2.gif) 0 -60px no-repeat; padding: 5px 0 5px 25px; color:#666; margin-bottom: 0; font-weight:normal; font-size: 13px">CONNECTIONS</h3>

which gets stripped to 

<h3 >CONNECTIONS
</h3>

But notice what got stripped out is not just the background image, but the (text) color, font-size, font-weight and margins.  Still, perhaps IBM's preprocessor takes a better safe than sorry attitude when there are any background graphics or that sort of thing.  Not smart, but possible.  What it doesn't explain is the following:

<font size="4" face="sans-serif"><strong>Spam
</strong></font>
<font color="#0000ff" size="4" face="sans-serif"><strong>Geek
</strong>
</font><font size="4" face="sans-serif"><strong> 
for Domino - SMTP Log
</strong></font>

which looks like this:  Spam Geek for Domino - SMTP Log

gets stripped to:

<font size="4" face="sans-serif"><strong>Spam
</strong></font>
<strong>Geek
</strong>
<font size="4" face="sans-serif"><strong> 
for Domino - SMTP Log
</strong></font>

which looks like this: Spam Geek for Domino - SMTP Log

I can't figure out what rule the preprocessor thinks it is following, and there are many similar cases where either the style or font attributes are stripped out.  Since I can't figure out the rules (yet), I have not been able to come up with really solid answers (yet), although I have discovered some ways to make it more likely that Lotus iNotes won't strip out styles and colors when it shouldn't.

Copyright © 2009 Genii Software Ltd.

What has been said:


838.1. Jerry Carter
(07/14/2009 01:46 AM)

Out of curiosity, what is the content type on the html or is it just inline html? It seems to be following some more recent HTML rules where the font tag is no longer valid. I don't have the spec right handy but HTML 4.0 or so I don't think uses the font tag - I'm pretty sure it's invalid XHTML Transitional. Maybe specifying a content type that supports the tag would leave it in?


838.2. Ben Langhinrichs
(07/14/2009 02:11 AM)

Interesting point, but this is 4.01 Transitional, in which the <font> tag is certainly allowed. This is MIME, so the content type is handled differently. That is actually another problem iNotes has, at least in 8.0.1, in that it adds an html and body tag, even if there already is one, so you get:

<html><body>   <html><body>
--- html ---
</body></html>   </body></html>

which is clearly incorrect. Also, it leaves two sets of font tags and strips out the other, virtually identical one.


838.3. Jerry Carter
(07/14/2009 02:14 AM)

Sadly, this seems consistent with some of the html rendering performed by the Domino server on Notes forms.