none
Transport Agents: Adding Recipients to an existing mail item. RRS feed

  • Question

  • Hi,

    I am using Exchange2010 Transport Agents and I am trying to add some custom recipients to a message when it is going through my Routing Agent.  From the samples I have gone through I seem to be doing things correctly and when I send the email I can see the "cc" Recipient (in Outlook), however the mail is never actually delivered to that additional address.  

    I'm trying to figure out what I am doing wrong, has anyone ran into a similar scenario?

     

            void Agent_OnSubmittedMessage(SubmittedMessageEventSource source, QueuedMessageEventArgs e)
    
            {
    
                e.MailItem.Message.Bcc.Add(new Microsoft.Exchange.Data.Transport.Email.EmailRecipient("Hidden User", "hidden@demodom1.local"));
    
            }
    

     

    Thanks - Greg.

     

     

    Monday, November 14, 2011 3:07 PM

Answers

  • Your only modifying the the P2(Display Envelope) recipients which contains all the information that that the user will see when they receive the message but this isn't what the MTA uses to route a message (eg things like BCC recipient aren't included in there etc). If you want the user your adding to receive the message you will need to add it to the P1 recipients via e.MailItem.Recipients If you don't want that address your adding to appear in the Message Recipients then don't add them to the P2 recips.

    Cheers
    Glen

    • Proposed as answer by Laeeq Qazi Tuesday, November 15, 2011 3:03 PM
    • Marked as answer by Greggomate Wednesday, November 16, 2011 4:32 PM
    Tuesday, November 15, 2011 3:19 AM

All replies

  • Your only modifying the the P2(Display Envelope) recipients which contains all the information that that the user will see when they receive the message but this isn't what the MTA uses to route a message (eg things like BCC recipient aren't included in there etc). If you want the user your adding to receive the message you will need to add it to the P1 recipients via e.MailItem.Recipients If you don't want that address your adding to appear in the Message Recipients then don't add them to the P2 recips.

    Cheers
    Glen

    • Proposed as answer by Laeeq Qazi Tuesday, November 15, 2011 3:03 PM
    • Marked as answer by Greggomate Wednesday, November 16, 2011 4:32 PM
    Tuesday, November 15, 2011 3:19 AM
  • Hi,

    The difference b/w P1 (Delivery Envelope) and P2 (Display Envelope) has been explained here by Glen.

    Processing BCC's in Exchange Transport Agents

    http://gsexdev.blogspot.com/2011/06/processing-bccs-in-exchange-transport.html

    Regards,


    Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com

    • Edited by Laeeq Qazi Tuesday, November 15, 2011 3:08 PM
    Tuesday, November 15, 2011 3:07 PM
  • Thanks guys, that did it.
    Wednesday, November 16, 2011 4:32 PM