Home All Groups Group Topic Archive Search About

Add internet header in Outgoing email? Sample Code

Author
15 Jan 2009 6:32 PM
freeman642@gmail.com

Dear all, driving me a bit mad, need to add an email header with a
title called lead ID: in the an outgoing mail and written a little
test app below. It works but when delivered the extra header is not
visible. What am I doing wrong? Any ideas gratefully received? I am
using Redemption, Exchange Server 2007 and a mix of Outlook 2000/2002
and Outlook 2003. Thanks John


Private Sub SendEmailTest()
Dim SafeItem, oISendItem

' send email with attachment
Set oOutlookApp = GetObject(, "Outlook.Application")
Set SafeItem = CreateObject("SecureEmail.SafeMailItem")
Set oISendItem = oOutlookApp.CreateItem(olMailItem)

Set SafeItem.Item = oISendItem

        Tag = SafeItem.GetIDsFromNames("{00020386-0000-0000-
C000-000000000046}", "x-test-header")
        Tag = Tag
        SafeItem.Fields(Tag) = "LEADID: 41567"
        'MsgBox (SafeItem.Fields(Tag))
        SafeItem.To = "helpd***@xxx.co.uk"
        SafeItem.Subject = "This is a Test"
        SafeItem.Save

        ' send the email with subject line and attached document
        SafeItem.Send

' make the email and objects nothing so resetting them
Set oISendItem = Nothing
Set oOutlookApp = Nothing

End Sub
Author
15 Jan 2009 6:52 PM
Ken Slovak - [MVP - Outlook]
When using GetIDsFromNames you must Or the result you get back with the type
of property tag, in this case PT_STRING8. So this line in your code:

    Tag = Tag

Should be:

    Tag = Tag Or &H1E ' PT_STRING8 == 0x0000001E

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


<freeman***@gmail.com> wrote in message
Show quoteHide quote
news:3e6abf8c-cd21-43df-a82b-65a3657e46cf@l33g2000pri.googlegroups.com...
> Dear all, driving me a bit mad, need to add an email header with a
> title called lead ID: in the an outgoing mail and written a little
> test app below. It works but when delivered the extra header is not
> visible. What am I doing wrong? Any ideas gratefully received? I am
> using Redemption, Exchange Server 2007 and a mix of Outlook 2000/2002
> and Outlook 2003. Thanks John
>
>
> Private Sub SendEmailTest()
> Dim SafeItem, oISendItem
>
> ' send email with attachment
> Set oOutlookApp = GetObject(, "Outlook.Application")
> Set SafeItem = CreateObject("SecureEmail.SafeMailItem")
> Set oISendItem = oOutlookApp.CreateItem(olMailItem)
>
> Set SafeItem.Item = oISendItem
>
>        Tag = SafeItem.GetIDsFromNames("{00020386-0000-0000-
> C000-000000000046}", "x-test-header")
>        Tag = Tag
>        SafeItem.Fields(Tag) = "LEADID: 41567"
>        'MsgBox (SafeItem.Fields(Tag))
>        SafeItem.To = "helpd***@xxx.co.uk"
>        SafeItem.Subject = "This is a Test"
>        SafeItem.Save
>
>        ' send the email with subject line and attached document
>        SafeItem.Send
>
> ' make the email and objects nothing so resetting them
> Set oISendItem = Nothing
> Set oOutlookApp = Nothing
>
> End Sub
Are all your drivers up to date? click for free checkup

Author
16 Jan 2009 8:04 AM
freeman642@gmail.com
Ken you are a genius, thank you so much. Cheers John

Show quoteHide quote
On 15 Jan, 18:52, "Ken Slovak - [MVP - Outlook]" <kenslo***@mvps.org>
wrote:
> When using GetIDsFromNames you must Or the result you get back with the type
> of property tag, in this case PT_STRING8. So this line in your code:
>
>     Tag = Tag
>
> Should be:
>
>     Tag = Tag Or &H1E ' PT_STRING8 == 0x0000001E
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm
>
> <freeman***@gmail.com> wrote in message
>
> news:3e6abf8c-cd21-43df-a82b-65a3657e46cf@l33g2000pri.googlegroups.com...
>
>
>
> > Dear all, driving me a bit mad, need to add an email header with a
> > title called lead ID: in the an outgoing mail and written a little
> > test app below. It works but when delivered the extra header is not
> > visible. What am I doing wrong? Any ideas gratefully received? I am
> > using Redemption, Exchange Server 2007 and a mix of Outlook 2000/2002
> > and Outlook 2003. Thanks John
>
> > Private Sub SendEmailTest()
> > Dim SafeItem, oISendItem
>
> > ' send email with attachment
> > Set oOutlookApp = GetObject(, "Outlook.Application")
> > Set SafeItem = CreateObject("SecureEmail.SafeMailItem")
> > Set oISendItem = oOutlookApp.CreateItem(olMailItem)
>
> > Set SafeItem.Item = oISendItem
>
> >        Tag = SafeItem.GetIDsFromNames("{00020386-0000-0000-
> > C000-000000000046}", "x-test-header")
> >        Tag = Tag
> >        SafeItem.Fields(Tag) = "LEADID: 41567"
> >        'MsgBox (SafeItem.Fields(Tag))
> >        SafeItem.To = "helpd***@xxx.co.uk"
> >        SafeItem.Subject = "This is a Test"
> >        SafeItem.Save
>
> >        ' send the email with subject line and attached document
> >        SafeItem.Send
>
> > ' make the email and objects nothing so resetting them
> > Set oISendItem = Nothing
> > Set oOutlookApp = Nothing
>
> > End Sub- Hide quoted text -
>
> - Show quoted text -
Author
16 Jan 2009 8:15 AM
freeman642@gmail.com
Sorry Ken one more quick question, my text is

Tag = SafeItem.GetIDsFromNames("{00020386-0000-0000-
C000-000000000046}", "ARM-LeadID")

But when it adds the ARM-LeadID it adds it as lower case, can this be
changed, doesnt really matter, just interested really.

Thanks John


Show quoteHide quote
On 16 Jan, 08:04, "freeman***@gmail.com" <freeman***@gmail.com> wrote:
> Ken you are a genius, thank you so much. Cheers John
>
> On 15 Jan, 18:52, "Ken Slovak - [MVP - Outlook]" <kenslo***@mvps.org>
> wrote:
>
>
>
> > When using GetIDsFromNames you must Or the result you get back with the type
> > of property tag, in this case PT_STRING8. So this line in your code:
>
> >     Tag = Tag
>
> > Should be:
>
> >     Tag = Tag Or &H1E ' PT_STRING8 == 0x0000001E
>
> > --
> > Ken Slovak
> > [MVP - Outlook]http://www.slovaktech.com
> > Author: Professional Programming Outlook 2007.
> > Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm
>
> > <freeman***@gmail.com> wrote in message
>
> >news:3e6abf8c-cd21-43df-a82b-65a3657e46cf@l33g2000pri.googlegroups.com....
>
> > > Dear all, driving me a bit mad, need to add an email header with a
> > > title called lead ID: in the an outgoing mail and written a little
> > > test app below. It works but when delivered the extra header is not
> > > visible. What am I doing wrong? Any ideas gratefully received? I am
> > > using Redemption, Exchange Server 2007 and a mix of Outlook 2000/2002
> > > and Outlook 2003. Thanks John
>
> > > Private Sub SendEmailTest()
> > > Dim SafeItem, oISendItem
>
> > > ' send email with attachment
> > > Set oOutlookApp = GetObject(, "Outlook.Application")
> > > Set SafeItem = CreateObject("SecureEmail.SafeMailItem")
> > > Set oISendItem = oOutlookApp.CreateItem(olMailItem)
>
> > > Set SafeItem.Item = oISendItem
>
> > >        Tag = SafeItem.GetIDsFromNames("{00020386-0000-0000-
> > > C000-000000000046}", "x-test-header")
> > >        Tag = Tag
> > >        SafeItem.Fields(Tag) = "LEADID: 41567"
> > >        'MsgBox (SafeItem.Fields(Tag))
> > >        SafeItem.To = "helpd***@xxx.co.uk"
> > >        SafeItem.Subject = "This is a Test"
> > >        SafeItem.Save
>
> > >        ' send the email with subject line and attached document
> > >        SafeItem.Send
>
> > > ' make the email and objects nothing so resetting them
> > > Set oISendItem = Nothing
> > > Set oOutlookApp = Nothing
>
> > > End Sub- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
Author
16 Jan 2009 1:42 PM
Ken Slovak - [MVP - Outlook]
It doesn't matter and you can't control the casing.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


<freeman***@gmail.com> wrote in message
news:d1f08d10-f17c-4e36-8e5b-7e53fcc2c051@v4g2000vbb.googlegroups.com...
Sorry Ken one more quick question, my text is

Tag = SafeItem.GetIDsFromNames("{00020386-0000-0000-
C000-000000000046}", "ARM-LeadID")

But when it adds the ARM-LeadID it adds it as lower case, can this be
changed, doesnt really matter, just interested really.

Thanks John

Bookmark and Share

Post Thread options