Ben Langhinrichs

Photograph of Ben Langhinrichs

E-mail address - Ben Langhinrichs







Recent posts

Wed 18 Sep 2019

Perils of PDF 5: Data Confusion



Mon 16 Sep 2019

About that email in Notes



Mon 9 Sep 2019

Perils of PDF 4: Missing and obscured data


November, 2019
SMTWTFS
     01 02
03 04 05 06 07 08 09
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Search the weblog





























Genii Weblog

Rich Text 101 - MIME/HTML

Mon 8 Sep 2003, 04:24 PM



by Ben Langhinrichs
Rich Text 101 logo

While the subject of MIME/HTML may not seem quite in keeping with this series on rich text topics, the truth is that rich text is a loose term understood generally to mean the rich content in a field or on a form.  Under this definition, MIME/HTML is critical, as an increasing number of "rich text" fields are actually MIME fields with HTML content.  The main reason for this is SMTP and Internet mail, which comes into Notes as MIME and is transformed into rich text for rendering in the Notes client.

First, a short explanation of what MIME is, and how it relates to HTML.  MIME stands for Multipurpose Internet Mail Extensions.  There are many good explanations of MIME on the web, such as this one.  The gist is that MIME was developed as a flexible way to send messages across the internet in a way that could be transmitted as "text" instead of "binary".  It was also developed as a way to store rich content in a multiple parts, so that a simple e-mail reader could read the plain text of the message, while a more advanced e-mail reader could read the HTML (or other) to get a more rich experience.

In the Notes client, which is more advanced, we are able to read MIME messages with HTML rich content.  Graphics are stored as additional MIME parts, but are put together by the Notes client when reading the message.  Attachments may also be stored as additional MIME parts.  One thing which is not widely recognized is that the MIME is converted to rich text for rendering, even if the rich text is displayed by Domino to a web browser as HTML.  This will be discussed later, as it points out one of the major limitations of MIME content in Notes/Domino.

As mail from the Internet is very common, it is also very common to receive MIME messages.  If you have received e-mail from the Internet, you can take a look at the MIME format by selecting an Internet mail message from the Inbox, but not opening it, and looking at the document properties.  The Body field will often be split into several parts, and each will indicate that it is a MIME part.  If the Body field shows as rich text, and you have not opened the document to look at the properties, and you have not modified the document, it is likely that your incoming mail is being converted to rich text on the server.  This is generally not good, and can lead to some badly formatted messages and often broken image references.  In general, the Format preference for incoming mail in the Domino Directory Person document should be set to "Keep in Sender's format." if you are reading mail with the Notes 5 or Notes 6 client.

Yawn!  

Sorry, that part was just getting a bit long winded.  Sorry about that.  Let's cut to the more interesting bits.  How can I use MIME in Notes? What is it good for?  What are the downsides?  How long until rich text is replaced entirely by MIME?

How can I use MIME in Notes?
There are two basic ways.  You can send rich text in e-mails in MIME format by ensuring that your e-mail preference for sending to the internet is set to either HTML Only or HTML and plain text, with the latter being a better choice.  Mail messages will be converted automatically, and graphics and formatting and such will be preserved on outbound messages.

The second way allows you to use MIME even internally.  When you create a rich text field, you have a checkbox (on the second tab of the Field properties) which lets you set the storage type to Store contents as HTML and MIME.   Checking this tells Notes that when the document is saved, the rich text field should be converted to and saved as MIME.  The "HTML and MIME" simply means MIME which has at least an HTML part.

What is it good for?
Well, that depends on whether you are thinking inside or outside the box.  It allows interaction with the Java applet to be somewhat more predictable, since that is the format that the Java applet recognizes.  It similarly is accessible to other application which want to access the field through MIME parts from the web.  As various connections to Notes content through DB2 and portals and such are strengthened, this format is likely to become more important.

Thinking further outside the box, it allows you to convert rich text to HTML without running the Domino web server or HTTP task.  This HTML can then be extracted using the NotesMIMEEntity class.

What are the downsides?
Unfortunately, they are rather large.  The conversion to HTML is not a clean one.  CSS is not used, so HTML font sizes are rather crude approximations of the original font sizes (e.g., 13pt, 14pt, 15pt, 16pt and 17pt all translate to 14pt after going through the save and re-opening).  A return is added to the rich text each time the conversion i made, so after saving several times, there is a large empty space before the rich text begins.  Tabbed tables become regular tables.  Table lines converted from small think lines to "Ridge" format.  All cell borders use the value in the upper left hand corner on the left side, so a fancy table such as this:

SalespersonRegionSales '03
Jorge GonzalesSouthwest$115,305
Xavier ThomasNortheast$420,485


may be rendered instead as:

SalespersonRegionSales '03
Jorge GonzalesSouthwest$115,305
Xavier ThomasNortheast$420,485


Then conversion of sections are is worse, as the section itself simply disappears, although the contents remain.

Why do you say MIME is always converted to rich text to display, and IBM says otherwise?
For some reason, many inside IBM, including developers, believe that MIME format is now supported natively in the Notes client.  This is clearly not true, as there are often messages about the conversion which trigger on opening the message, and as I have confirmed using an extension manager testing utility.  In R5, the same conversion is done when the document is rendered to the web, but it is possible (yet to be tested) that it has been fixed in ND6.  I'll update this document when I have further information.

How long until rich text is replaced entirely by MIME?
It isn't likely to happen anytime soon, thank goodness.  The higher priority at IBM right now is storing data in DB2, but it is easier to leave the basic storage as rich text and store that as a DB2 blob than to change the basic rich text format for now.  If handling of MIME gets more powerful, this might happen, but I personally think a conversion to XML is more likely, and also more desirable.

Copyright © 2003 Genii Software Ltd.

What has been said:


45.1. Heini
(09/09/2003 02:41 PM)

Dear Ben,

very interesting article. If your prediction about the DB/2 store is true this option loses much of its attraction. I really hoped that this will push Rich Text to new limits. Seems that we will need Midas Rich Text for a very long time :o)

Have a nice week.

Cheers

Heini


45.2. Mark
(09/09/2003 07:39 PM)

My take on the DB2 store is that IBM will allow similar options to convert CD to MIME on write. This will allow emerging Lotus Workplace offerings access to legacy Notes/Domino data with a common data store in and industry standard format. Of course, no one can be certain that the conversions will be any good. Actually, I'm fairly sure they'll be exactly as they are today. ;-)


45.3. Ben Langhinrichs
(09/10/2003 06:34 AM)

My predictions about DB2 are certainly not guesswork. The people implementing this have stated pretty clearly that the current rich text format would be used in DB2. If anything, it is more of a stretch thinking they will implement MIME differently.


45.4. Mark
(09/12/2003 03:15 PM)

Most certainly! They've gotten great marks for maintaining backward compatibility. I suspect there will be storage preferences, much like the current mail settings. I'm thinking: Store as XML/MIME, Store as Native Rich text, etc. and that Notes CD stuff that doesn't "translate" will become NSF-specific CDATA.


45.5. Gerco
(09/14/2003 11:07 AM)

In the Notes 6 client, you can open an internet mail message and choose view - page source. This is an easier way to see the MIME parts. And if that option is greyed out, you're looking at a converted message :-)


45.6. Ben Langhinrichs
(09/14/2003 06:35 PM)

Mark - They might go with preferences. That seems the direction they are heading with the field preference now.

Gerco - Good point. That would be a more obvious way of telling. Thanks for pointing that out.


45.7. Steve Castledine
(09/22/2003 07:06 AM)

Hi Ben

From my research I found embedding the Rich Text field (set as save mime) in a table cell that is embedded in another table cell (so two tables) fixes the return being added at each save. In R5 these tables cannot be within a tabbed table as it crashes the client (without an error message) - but in ND6 works fine.


45.8. Ben Langhinrichs
(09/22/2003 07:14 AM)

Steve - I quail to think of the research which would lead you to this, but appreciate the tip. Always good to know a workaround.


45.9. Steve Castledine
(09/22/2003 08:52 AM)

I remember spending weeks trying to fix this sort of issue - I think I actually discovered this by accident. What im trying to do next is parse the poor html that Domino creates from rich text into something half decent and try and auto create css etc - whether I will be successfull - who knows - maybe I will do it by accident again!


45.10. Michael Sobczak
(09/23/2003 02:28 PM)

I have a scheduled agent that sends out notifications when new documents are created in a db. I'd like the formatting to be retained when these messages are sent to non-Notes mail users.

Have you seen any good tutorials or magazine articles that show how to create a MIME message in Lotusscript or Java?


45.11. Michael Sobczak
(09/24/2003 07:36 AM)

The messages I need to send need to include anchor links (<a>) that have notes URLs (notes://). The recipients use Notes clients for apps, but not for mail. I seems like the best way to do this is to create an HTML formatted message and send it as a MIME.


45.12. Joe Fanning
(02/27/2004 03:04 PM)

Can I change MIME TEXT/PLAIN; to HTML to use for a website


45.13. Michael Anteau
(09/23/2004 09:28 AM)

Hi Ben,

I seem to be having a problem related to the java applet and MIME. I created a rich text field on a custom form, which is created and saved via a web browser. When I re-open it, nothing shows on the web. When I look in the Domino client, the field shows MIME parts stored. Nothing shows in Domino either. I tried checking and unchecking the MIME option on the second tab, but the behavior is the same. Am I missing something obvious? Any help you can provide would be GREATLY appreciated.


45.14. atul
(12/25/2004 06:46 AM)

I was earlier using IE and presently using opera.

Had saved lot of files thru IE in HTML but am recently noting that whenever i try opening them , they open in MIME which is clearly not at all convenient.is it connected to the recent updates i had unloaded from Microsoft which somehow have disabled opening of earlier saved html docs.

pl do solve


45.15. Sunil
(08/11/2005 11:41 AM)

I am having an issue to hide a rich text field which has the mime enabled. Any help would be greatly appreciated. I have already tried using a space in front of the field but didn't work. The application is also used in R5.

Sunil


45.16. Bill Mitchell
(12/15/2005 07:58 AM)

Hey Steve or others re: 49.9. Steve Castledine (09/22/2003 08:52 AM)

"What im trying to do next is parse the poor html that Domino creates from rich text into something half decent and try and auto create css etc - whether I will be successfull - who knows - maybe I will do it by accident again!"

Any LUCK since 2003... by accident? I'd like to convert Notes into HTML with span classes for bold, italic, fonts etc. Thus utilize CSS! Anyone else?

Thanks.


45.17. sameer
(02/08/2007 11:41 PM)

above information is nice !!!!

Here I am ctreating an application in asp.net, in that i need to store the richtext in the database,so could you pls help me out to solve this problem??????

Thnx.regds.


45.18. Jatin Shukla
(04/12/2007 05:03 AM)

I am having a problem, in getting the image portion of MIme field in Notes. The text and styling is rendered correctly on internet, except for the image.

Can somebody advise, how to get image stored as mime in multimart mime to display on internet.