CDO/Redemption and embedded graphics Outlook XP

K

Kristy

I am using Exchange 2000, Windows XP, and have written a Com add-in
for Outlook 2000/2002(VB6). I am also using the re-distributable
version of Outlook Redemption.

Currently I am using CDO and an excellent code example from "Neo" to
embed a graphic into a new email (and also on reply and forward).
Because of the security patch I now want to use Outlook Redemption
instead of CDO.

Using the example provided at http://www.dimastr.com/redemption I have
successfully changed the code for new messages to something like
this...

Set DraftsFolder = Application.Session.GetDefaultFolder(16)
Set MailItem = DraftsFolder.Items.Add
Set sItem = CreateObject("Redemption.SafeMailItem")
sItem.item = MailItem

'Hide paper clip
PT_BOOLEAN = 11
PR_HIDE_ATTACH = sItem.GetIDsFromNames("{00062008-0000-0000-C000-000000000046}",
&H8514) Or PT_BOOLEAN
sItem.Fields(PR_HIDE_ATTACH) = True

'add attachment
Set attach = sItem.Attachments.Add(TemplateDir & EmailLogoType)
'content type
attach.Fields(&H370E001E) = "image/jpeg"
attach.Fields(&H3712001E) = "ABC"
sItem.HTMLBody = "<IMG align=right border=0 hspace=0 src=cid:ABC>"
sItem.Save
EID = sItem.EntryID

'de-reference the old item
Set attach = Nothing
Set sItem = Nothing
Set MailItem = Nothing
Set DraftsFolder = Nothing

'display email
Set sItem = Application.Session.GetItemFromID(EID)
sItem.Display

Call EmailLetterheadIdentifier
Call InsertSignatures

' clean up sItem
Set sItem = Nothing


However having applied this to Reply I am getting a box and cross
instead of the graphic being embedded when I display the email. If I
send it and then open it, it displays as expected with the graphic
embedded. Any ideas on why it doesn't display correctly initially?
Code for reply is the same except for instead of creating an Item in
the drafts folder, I use the current item.

Set oReply = objItem.Reply
Set sItem = CreateObject("Redemption.SafeMailItem")
sItem.item = oReply


Also, when using the 'Hide paperclip' code with both cdo and
redemption it doesn't always work. When I send from one exchange
server to another external exchange server the paper clip is visible
(internally it's fine, when from a non exchange environment to
exchange it's fine, or when sent from exchange to non-exchange
environment it works also - all clients being Outlook)?

One more question... does anyone know if you can programmatically
insert the default signature using Outlook Redemption - I'm currently
using commandbar controls to do this but am having some problems
calling this programmatically from another click event.

Thank you
 
D

Dmitry Streblechenko

Most likely Outlook caches a bunch of data at the time objItem.Reply is
called and does not see any changes made by Redemption.
You are already resetting all variables to Nothing and using GetItemFromId
to reopen the message, to take care of the possible implicit variables
created by the compiler, try to move the code creating the message to a
separate sub (this way all implicit variables will be dereferenced when the
sub exists), then reopen the message outside of that sub.

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