Outlook 2003: convert all RTF emails to HTML

  • Thread starter Amedee Van Gasse
  • Start date
A

Amedee Van Gasse

3 years ago we migrated from Lotus Notes to Exchange 2003 + Outlook
2003.
As you may or may not know, the default email format of Lotus Notes is
RTF, and after migration all mails were in RTF.
I'm not sure what the official default is for Outlook 2003, but in our
company it is set to RTF (although users can change that to HTML if
they want).


We started looking at some huge mailboxes.
Some had multi-megabyte images inline (usually printscreens).
When these emails were converted from RTF to HTML as a test, there was
a _drastic_ size reduction, between 10x and 100x smaller.


One of these days I expect a request to convert ALL emails of certain
mailboxes from RTF to HTML.
My question to the newsgroup is: is this technically possible? Without
any special stuff like Outlook Redemption? If the answer is yes, then
I'll reserve some time to look into it. If it can't be done, then I
would like to know too, to be prepared when I get the question.
 
M

Michael Bauer [MVP - Outlook]

Not sure if it retains all the formattings, but in principle just loop
through the Items collection and set each item's BodyFormat=2, then call
Save.

--
Best regards
Michael Bauer - MVP Outlook
Category Manager - Manage and share your categories:
SAM - The Sending Account Manager:
<http://www.vboffice.net/product.html?lang=en>


Am Fri, 7 May 2010 05:52:02 -0700 (PDT) schrieb Amedee Van Gasse:
 
A

Amedee Van Gasse

Not sure if it retains all the formattings, but in principle just loop
through the Items collection and set each item's BodyFormat=2, then call
Save.

Michael,

This is my code, still needs some cleanup:

Sub RTF2HTML()

On Error Resume Next

Dim ns As NameSpace
Dim Inbox As MAPIFolder
Dim Item As Object
Dim oldSize As Integer
Dim newSize As Integer

Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)

If Inbox.Items.Count = 0 Then
MsgBox "There are no messages in the Inbox.", vbInformation, _
"Nothing Found"
Exit Sub
End If

For Each Item In Inbox.Items
If Item.BodyFormat = olFormatRichText Then
oldSize = Item.Size
Item.BodyFormat = olFormatHTML
Item.Save
newSize = Item.Size
Debug.Print oldSize & vbTab & newSize
End If
Next Item
End Sub

Some observations:
+ mails get converted from RTF to HTML
+ attachments move from inline to header
- size increases with the length of the HTMLBody. So the RTFBody
probably isn't removed from the mail.
- inline images are lost

Perhaps this is not the right way to go.
My goals are:
* Mail size should decrease, or increase only marginally
* Inline images should be preserved inline
* Inline images in RTF are uncompressed bitmaps, they should become
compressed images (PNG or whatever Outlook uses internally for
compressing embedded images in HTML mail). Quality loss is acceptable
to a certain degree, for example 85% JPEG compression would be fine.

FYI, this is the top of a converted email:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>

<META NAME="Generator" CONTENT="MS Exchange Server version
6.5.7036.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

After that the actual mail body starts.

Any ideas?

Kind regards,
Amedee Van Gasse
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top