Redemption - can't see message body


Joe Black


I create email using code below. Email gets sent but when I open the email
from Sent Items in Outlook, the email body is completely blank - no text at
all. The recipient can read the email when it arrives with no problems, but
I can't.

Any ideas?

Option Compare Database
Option Explicit

Public Sub SendTheMessage(ByVal DisplayMsg As Boolean, ByVal strAddress As
String, Optional AttachmentPath As String, Optional HTMLBodyText As String,
Optional MsgSubject As String)
Dim objOutlook As Object
Dim objOutlookMsg As Object
Dim objOutlookMAPI As Object
Dim objOutlookRecip As Object

On Error GoTo Oops
On Error GoTo 0
Set objOutlook = GetObject("", "Outlook.Application")

Set objOutlookMAPI = objOutlook.GetNamespace("MAPI")
Set objOutlookMsg = objOutlook.CreateItem(0)

Dim SafeItem
Set SafeItem = CreateObject("Redemption.SafeMailItem")
SafeItem.Item = objOutlookMsg

With SafeItem
Set objOutlookRecip = .Recipients.Add(strAddress)
objOutlookRecip.Type = 1

If Not IsMissing(MsgSubject) Then .Subject = MsgSubject

If Not IsMissing(HTMLBodyText) Then
If Len(Trim(HTMLBodyText)) > 0 Then .HTMLBody = HTMLBodyText
End If

If DisplayMsg Then
End If

End With


Set SafeItem = Nothing
Set objOutlook = Nothing
Set objOutlookMsg = Nothing
Set objOutlookRecip = Nothing
Set objOutlookMAPI = Nothing
Set btn = Nothing
Set objExplorer = Nothing

Exit Sub
MsgBox "Error number " & Err.Number & ": " & Err.Description
Resume Cleanup
End Sub



Ken Slovak - [MVP - Outlook]

Try setting the message content in the Outlook mail item and not in the
Redemption item. Writing to Body or HTMLBody isn't restricted. You only need
to use the SafeMailItem for the recipients.



Dmitry Streblechenko \(MVP\)

As Ken said, Outlook does not block writing to the Body and HTMLBody
properties, so even if you use Redemption to set them, the call will still
go to the Outlook Object Model. If you look at the message in the Sent Items
using MdbView or OutlookSpy, can you see PR_BODY and PR_RTF_COMPRESSED?

Dmitry Streblechenko (MVP)
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