locked
O365/EWS - Get the Original Recipient Email Address when Mailbox has Multiple Email Addresses associated with it RRS feed

  • Question

  • I'm in a Hybrid Environment with E2010 and Exchange Online (Office 365) and am using Exchange Web Services Managed API (EWSMA) to process emails in a Shared mailbox.

    I have a Shared Mailbox that has the Following Email Addresses:

    user@domain.com (Primary SMTP)
    user@domainA.com
    user@domainB.com
    user@domainC.com
    user@domainD.com

    I want to know via Exchange Web Services (EWS) if the mail was sent to user@domainA.com or user@domainB.com, etc, not just the Primary SMTP Address.   When I look at the Message Item in EWS it only ever shows the Primary SMTP. 

    I would like to be able to get the original Recipient Address from the Message, though all attempts have failed. I only ever get the Primary SMTP Address.   If I go to Properties of the Message in Outlook and look at the Internet Headers I can see the To: Header with the Address I want.

    Though when I look at the email inside of EWS I only get the Primary SMTP Address.

    If I try to create a Transport Rule for recipient Domain, it only works when its the domain for the Primary SMTP Address of the Mailbox. 

    If I create a Shared Mailbox with the Primary SMTP with the Domain I want and the Forward that to the Shared Mailbox for Processing, the Transport Rules don't get triggered until after the Forward and only for that destination's domain and not the original. 

    Friday, August 3, 2018 8:04 PM

All replies

  • Exchange will always resolve the proxy address back to the Primary because what ends up getting stored on the Message itself is the Native EX address of the Recipient.

    >>  If I go to Properties of the Message in Outlook and look at the Internet Headers I can see the To: Header with the Address I want.

    One workaround is to parse the value out of those Headers which should work most of the time with a few edge cases for BCC etc. You should also be able to get the original headers from the pidTagMimeSkeleton see https://docs.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/hh545614(v%3Dexchg.140

    Cheers
    Glen

    Monday, August 6, 2018 4:56 AM