Unknown error on RTF formatted email after applying Redemption

B

Bingo

I need to forward emails to a specific email account but
still keep the original subject and message body.

I use Redeption SafeMailItem to get the RTFbody from the
original mail item and pass it on to the new mail item
(OriginalMailItem.Forward). Then I send out the mail
item. On the other side, once I got the forwarded
emails, I run an VB app to on those mail items. If the
mail is in RTF format with embedded OLE objects,

oMapiMailItem.ReplyAll and
oMapiMailItem.Forward both are working correctly.

But if the mail has no message body or just plain text in
the body, the above two commands failed and VB generates
an Unknown error.

I tried to send email from Redemption SafeMailItem and
Outlook MailItem after applying the RTFbody and both have
the same problem with RTF formatted emails--with either
no message body or plain text body.

What's the work-around? Thanks.
 
B

Bingo

I'll post the code shortly.

Just found out that Outlook cannot print these emails
either. Thanks.
 
B

Bingo

Dmitry,

The following are two portions of the code I have. The
top one is used to send out an email using the RTFbody
off SafeMailItem. The 2nd part is where the error
actually happens.


' The code to "forward" an email
' to a specified email account

' Get mail item by mail ID
Set oMapiMail = oNsp.GetItemFromID(sMailID)

' Forward method will change mail
' subject and mail body
Set oMapiMailNew = oMapiMail.Forward

' Get the same formatting
With oMapiMailNew
.Subject = oMapiMail.Subject
If oMapiMail.HTMLBody = vbNullString Then
bRdp = True ' Use the RTF property of
' the Redemption Safe Mail
' Item
Else
bRdp = False ' Use the HTML property of
' the Outlook Object Mapi
' Mail Item
.HTMLBody = oMapiMail.HTMLBody
End If
.MessageClass = CustomMessageClass
.Save ' Save the cloned mail item
' to avoid outlook object
' overwriting redemption
sMailID = oMapiMailNew.EntryID
End With

' Re-cycle the object
Set oMapiMailNew = Nothing
Set oMapiMailNew = oNsp.GetItemFromID(sMailID)

' Add the mailbox as the only recipient
Set oMapiRecipient = oMapiRecipients.Add("bingo")
With oMapiRecipient
.Type = 1 ' 1: olTo
End With

' Populate the hidden fields
With oMapiMailNew
.UserProperties("abc") = "abc"

' To keep the RTF formatting of the
' original mail item
If bRdp Then
Set oRdpMail = CreateObject
("Redemption.SafeMailItem")
Set oRdpMailNew = CreateObject
("Redemption.SafeMailItem")
' Original mail item
oRdpMail.Item = oMapiMail
' Clone mail item
oRdpMailNew.Item = oMapiMailNew
' Get the original RTF formatting
oRdpMailNew.RTFBody = oRdpMail.RTFBody
' oRdpMailNew.Send ' I tried this as well
End If
.Send
End With


'--------------------

' After sending the email, the following code is
' used on the receiving side
' to operate on the email
' Reply, ReplyAll, Forward and Print operations
' in VB app will all fail
' an unknow error generates
' Print will fail even in Outlook but Reply,
' ReplyAll and Forward work fine
' in Outlook on the same email

Set oMapiMailReply = oMapiMail.ReplyAll
Set oMapiMailForward = oMapiMail.Forward
 
D

Dmitry Streblechenko \(MVP\)

You will get errors in case of the embedded OLE objects since RTFBody refers
to the embedded objects which are attachments, but you do not copy
them.(andt here is no easy way to copy them)
Try to use SafeMailItem.CopyTo instead - it will copy all properties,
including the RTF body and attachments.

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

Bingo

Dmitry,

I got what you say. But the unknown error only happens
with RTF formatted emails without OLE objects. In other
words, it works fine if there are OLE objects. For RTF
emails with either plain text or no empty body, the
unknown error happens. But I'm going to try the CopyTo
method as you recommended. I'm pretty sure if you try
the code I provided, you'll see the error. Thanks.
 
B

Bingo

Dmitry,

I use Outlook Spy checked on these emails. When I run
the Call of Forward function, I got Return Error Code
0xD0720009. The Return Code for Reply function is
0xD6A20009, the code for ReplyAll is 0xDAC20009, the code
for PrintOut is 0xE0F20009. All other functions are OK.
Hope this helps.
 
D

Dmitry Streblechenko \(MVP\)

Can you send to my private address the problematic messages saved as MSG
files (File|Save As), zipped (important!).

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

Bingo

Dmitry,

After I rebuilt the custom form and cleared the form
cache, this problem went away. Thanks!
 

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