Link to home
Start Free TrialLog in
Avatar of rbichon
rbichon

asked on

Add custom header to Outlook Message in VBA

How do you add custom headers to a message in Outlook using VBA?
ASKER CERTIFIED SOLUTION
Avatar of Serena Hsi
Serena Hsi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rbichon
rbichon

ASKER

I found out that if you mark the message as private, it sets a header called Sensitivity which I can use for my purposes.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Item.Sensitivity = olPrivate
    Cancel = False
End Sub
rbichon,
that's very interesting.

Can you send me an example in VB.NET that sends a message with some "custom information" using the <sensivity> header?
Also, it would be needed the code to "read" the message's <sensivity> header once is received on the other end.
I hope this is the solution that works!

Thank you,
Avatar of rbichon

ASKER

We use Microsoft Exchange Server 2007 to handle our email. In that server program, you can setup rules that are able to read the headers of the emails and perform an action based on what it finds.
In my specific application, we have the Exchange server copy all of our outgoing emails to a central email address so the owner can read what people are sending to the companies clients. However, if our users want to keep the email confidential, all they have to do is mark the email Private and it will bypass the filter.
In short, I don't use VB.Net in this application as Outlook tries to block programs that attempt to gain control over it.