Add custom header to Outlook Message in VBA

Posted on 2007-10-03
Last Modified: 2009-11-20
How do you add custom headers to a message in Outlook using VBA?
Question by:rbichon
    LVL 16

    Accepted Solution

    This site has a COM add-in sample for Outlook header info. Don't forget to backup your registry before you go poking around with it with someone else's code:

    You can find other code samples here:

    Related items:
    LVL 1

    Author Comment

    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

    Expert Comment

    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,
    LVL 1

    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now