Take the 2-minute tour ×

The add-in I'm trying to build has to change the BCC field of a new mail depending on the sender's address.

As I'm new to Outlook programming, I foud this article and built the example add-in. The event they used is NewInspector, which, as you can read, is fired right before a new outlook item window appears. However if we paste this code in the NewInspector event handler:

        Outlook.MailItem item = Inspector.CurrentItem as Outlook.MailItem;
        if (item != null)
            if (item.EntryID == null)
                if (item.SenderEmailAddress == "...")
                    item.BCC = "....";

It doesn't work, because the sender's address is empty when the window has just loaded.

I thought about using the Send event, each new mail created will have its Send event handler attached to a method which, in its turn, will change the BCC depending on the sender's address when the email is sent.

The only problem is, for some reason, I can't see the Send event in VS 2010 Pro.

Are there any other ways to do what I need?

share|improve this question
add comment

1 Answer

You need to use the event interface (Outlook.ItemEvents_10_Event) of the Outlook.MailItem since it has both a method and event tied to the same name (Send). This is just one of the quirks you have to be aware of in the Outlook Object Model. This should work for you:

((Outlook.ItemEvents_10_Event)MailItem).Send += new Outlook.ItemEvents_10_SendEventHandler(MailItem_Send);
share|improve this answer
add comment

Your Answer


