X-Fields how?

T

Trudeu

I have put the following script into the Thisoutlooksession of Outlook 2000

When I sent mail however the x-test header is not found in the mail i send.
HOWEVER...

A blank mail is created in the drafts folder, when I open this blank email
in the drafts folder and send mail using this blank email the X-header is
there.
I have read the faq at Redemption web site but dont understand what it will
take to make this work properly.
Can someone show me the code that needs to be added to make this work .

Thanks.

'---------------------------------------------------------------------------
------------'
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Set myolApp = CreateObject("Outlook.Application") ''
Set MailItem = myolApp.CreateItem(olMailItem) ''

Set sItem = CreateObject("Redemption.SafeMailItem")
sItem.Item = MailItem
Tag = sItem.GetIDsFromNames("{00020386-0000-0000-C000-000000000046}",
"x-test-header")
Tag = Tag Or &H1E 'the type is PT_STRING8
sItem.Fields(Tag) = "test value"
sItem.Subject = sItem.Subject 'to trick Outlook into thinking that
something has changed
sItem.Save

End Sub
 
D

Dmitry Streblechenko

Why do you create a new message?

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Set sItem = CreateObject("Redemption.SafeMailItem")
sItem.Item = Item
Tag = sItem.GetIDsFromNames("{00020386-0000-0000-C000-000000000046}",
"x-test-header")
Tag = Tag Or &H1E 'the type is PT_STRING8
sItem.Fields(Tag) = "test value"
sItem.Subject = sItem.Subject 'to trick Outlook into thinking that
something has changed

End Sub


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

Trudeu

Thanks very much, that works

Dmitry Streblechenko said:
Why do you create a new message?

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Set sItem = CreateObject("Redemption.SafeMailItem")
sItem.Item = Item
Tag = sItem.GetIDsFromNames("{00020386-0000-0000-C000-000000000046}",
"x-test-header")
Tag = Tag Or &H1E 'the type is PT_STRING8
sItem.Fields(Tag) = "test value"
sItem.Subject = sItem.Subject 'to trick Outlook into thinking that
something has changed

End 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