Sending RTF using Redemption

M

mvandemore

What is the proper way to store a RTF string to the Item.RTFBody?

I need to store a heavily formatted RTF letter (lots of tab stops,
hanging indents, etc.) as the body of an email. When I store it using
"Item.RTFBody = sRTFLetter" the tab stops appear to get lost. Do I
need to set some other property first in order for it to maintain the
formatting? (Oddly Outllok says it's "Plain Text" even though it
clearly isn't since the fonts come across just fine.
 
D

Dmitry Streblechenko

Is the PR_MSG_EDITOR_FORMAT (0x59090003) property set? If yes, can you try
to delete it?

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

mvandemore

Dmitry said:
Is the PR_MSG_EDITOR_FORMAT (0x59090003) property set? If yes, can you try
to delete it?

I am not currently setting that property. Just for kicks I tried
adding this code, but it didn't make a difference:

Const PR_MSG_EDITOR_FORMAT = &H59090003
Const EDITOR_FORMAT_RTF = 3

Attach.Fields(PR_MSG_EDITOR_FORMAT) = EDITOR_FORMAT_RTF

Here is exactly what I'm trying to do, of course to make it more
complicated I need to embed a graphic for the "letter head". I'm using
this in combination with TXTextControl. (http://www.textcontrol.com/)
If I stop the program right after the string sRTFBody has been
assigned, write the contents of that string to a file (I cut & paste it
using notepad) and then open the file, all of the RTF formatting is
intact, so I know the "sRTFBody" string is good.

PR_HIDE_ATTACH =
sItem.GetIDsFromNames("{00062008-0000-0000-C000-000000000046}", &H8514)
Or PT_BOOLEAN
sItem.Fields(PR_HIDE_ATTACH) = True
' Add Graphic attachment
Set Attach =
sItem.Attachments.Add(lblFilePath(FilePathTypes.Graphic).Tag)
' Content Type
Attach.Fields(&H370E001E) = "image/gif"
' Attachment CID
Attach.Fields(&H3712001E) = "myident"

' Add RTF
sRTFBody =
txTextControl(LetterTypes.CoverLetter).SaveToMemoryBuffer(sRTFBody,
TXFormats.RTF)
sItem.RTFBody = sRTFBody
' Show Email
sItem.Display

I looked for, but couldn't find, an example using the RTFBody property
on the Redemption website. If you can point me to something I would be
grateful.

Thanks
 
D

Dmitry Streblechenko

RTF does not embed images the same way HTML does (you do that for HTML). In
RTF all images are OLE objects stored in attachments of the special kind
(ATTACH_OLE). In HTML they are just regular attachments with an extra
property (PR_ATTACH_CONTENT_ID) set.
Do you open the message immediately after you set the RTF body? In this case
Outlook might be using a cached value of the message. Do you still see
"Plain Text" after you restart Outlook?

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

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