RTF only shows as plain text

  • Thread starter Thread starter Mike Lindeboom
  • Start date Start date
M

Mike Lindeboom

In the code below I am setting the content to red and bold using the
Redemption RTFBody property. Whan I display the MailItem the text is
plain. What am I doing wrong?

Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objMailItem As Outlook.MailItem
Dim objRecip As Outlook.Recipient
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objMailItem = objApp.CreateItem(olMailItem)

Dim mySafeMail As Redemption.SafeMailItem
Set mySafeMail = CreateObject("Redemption.SafeMailItem")
mySafeMail.Item = objMailItem
mySafeMail.RTFBody =
"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0
Arial;}}{\colortbl ;\red255\green0\blue0;}\viewkind4\uc1\pard\cf1\b\f0\fs20
TESTING\cf0\b0\par}"
objMailItem.Save

objMailItem.Display



Set objMailItem = Nothing
Set objApp = Nothing
Set objNS = Nothing
 
Outlook does not see changes made with anything but OOM until you
dereference and reopen the message.
After setting the RTFBody property, use the following code

objMailItem.Save
strEntryID = objMailItem.EntryID
set objMailItem = Nothing
set mySafeMail = Nothing
set objMailItem = objNS.GetItemFromID(strEntryID)
objMailItem.Display

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top