View Single Post
  #10  
Old January 29th 08, 07:14 PM posted to microsoft.public.outlook.program_vba
Sean
external usenet poster
 
Posts: 20
Default Redemption, Help with selecting E-mail Account

Ken, when I right click on debug message, it shows Mapiutils under
classes and I can see MAPIIOBJECT under members, although don't know
what all that means

I declared what you said as
Dim NameSpace As Object
Dim RDOSession As Object

But it debugs with the exact same message.

I've looked at the Redemption site and under FAQ # 14 it seems to do
exactly what I want my means of "hard coding" a From name and addy,
the text of it is below, but how would I incorporate that to twaek my
code, on the assumption that I can't get above to work

Is there any way I can select an account to be used for sending a
message with Redemption?

Generally speaking, no. If you look at the message sent using non-
default account using OutlookSpy, you will notice that Outlooks sets a
couple of named properties; one of them is the name of the account,
another one is a combination of the account integer index and its
name. The format is not documented of course.

The good news however is that you can do much better than just
selecting an account: you can set the sender name and address to an
arbitrary value, you do not need to have an account configured with
that name and address. The trick is based on the fact that you can add
a named property with a particular GUID to an outgoing message and
force Outlook to use the name of the property as an RC822 header and
its value as the value of the header. By adding a property with the
name "From" and the value in the form "Someone "
you add an RF822 header:

From: Someone

Both Exchange and IMAIL providers are smart enough to replace an
existing header if one exists, i.e. you will not get two "From"
headers. The only limitation is that the message must be converted to
the RFC822 format along the way, it will not work if the message is
sent between two mailboxes on the same Exchange server. The message in
your Sent Items folder will still have the default sender name, but
the recipients will see the new value. Whether you use IMAIL (POP3/
SMTP) or Exchange provider in Outlook to send a message, doesn't
matter at all, it will work in both cases.

set sItem = CreateObject("Redemption.SafeMailItem")
sItem.Item = MailItem
tag = sItem.GetIDsFromNames("{00020386-0000-0000-C000-000000000046}",
"From")
tag = tag or &H1E 'the type is PT_STRING8
sItem.Fields(Tag) = "Someone "
sItem.Subject = sItem.Subject 'to trick Outlook into thinking that
something has changed
sItem.Save


Ads