none
[E2016] Inspect incoming mails on Exchange Server 2016 on a global level RRS feed

  • Question

  • Hi.

    We are using E2016 and we would like to do inspect/tag all incoming mails. In particular store certain incoming mails to the file system and also add custom mail headers for later classification.

    Ideally this should be done on a global level and not on each Mailbox.

    So far we have an Outlook Plugin which does the job. But a downside is that Outlook needs to be running. Mails are only processed once they are received by Outlook. Which could be days later if the person is on vacation for example. Also it's very common that mails have multiple recipients which are received into many mailboxes. That causes the same mail to be processed multiple times, which is not ideal.

    What would be the preferred way of doing this?

    We do not have much experience with Exchange Server development so far. We looked into EWS, but it seems it's operating only on the mailbox level. I've also read about Transport Agents. But couldn't find any up to date developer documentation for 2016. For example can something like this still be done with Exchange 2016: https://msdn.microsoft.com/en-us/library/office/aa579185(v=exchg.140).aspx . Would this be the way to go?

    Regards.

    Friday, January 19, 2018 1:49 PM

Answers

  • Transport Agents would allow you to process the Mail while it is in Transport Pipeline and is the only solution for doing the type of thing your talking about that would include both mail sent Internal between user or from external sources. Transport Agent haven't change much between 2013 and 2016 not sure why they didn't update the documentation through.

    >>Also it's very common that mails have multiple recipients which are received into many mailboxes. That causes the same mail to be processed multiple times, which is not ideal.

    What ever solution you use this is something that you need to deal with in your code logic as forking and expansion of recipients means that you will always encounter that issue. Messages will have an unique Internet MessageId which is generally a good place to start. 

    One problem with Transport Agents is if you have plans to migrate into the Cloud at anytime in the near future this won't work. In the cloud you would need to approach this as an Agent based solution eg on solutions is you write your own agent using one of the Mailbox API like REST or EWS and that agent will constantly run and process email as they arrive in the target mailboxes. Or a simpler version of this is  if you can detect any email that you need to process using Conditions in Transport Rules use these to create a copy of the Message that will be forward to a special Mailbox. Then use one of the Mailbox API's to just process messages from this mailbox, if you then need to update the original email write and Async process that find the message in the recipients mailbox and update that in the background.

    Cheers

    Glen

    • Marked as answer by Coder_N Wednesday, January 24, 2018 8:44 AM
    Sunday, January 21, 2018 11:06 PM

All replies

  • Transport Agents would allow you to process the Mail while it is in Transport Pipeline and is the only solution for doing the type of thing your talking about that would include both mail sent Internal between user or from external sources. Transport Agent haven't change much between 2013 and 2016 not sure why they didn't update the documentation through.

    >>Also it's very common that mails have multiple recipients which are received into many mailboxes. That causes the same mail to be processed multiple times, which is not ideal.

    What ever solution you use this is something that you need to deal with in your code logic as forking and expansion of recipients means that you will always encounter that issue. Messages will have an unique Internet MessageId which is generally a good place to start. 

    One problem with Transport Agents is if you have plans to migrate into the Cloud at anytime in the near future this won't work. In the cloud you would need to approach this as an Agent based solution eg on solutions is you write your own agent using one of the Mailbox API like REST or EWS and that agent will constantly run and process email as they arrive in the target mailboxes. Or a simpler version of this is  if you can detect any email that you need to process using Conditions in Transport Rules use these to create a copy of the Message that will be forward to a special Mailbox. Then use one of the Mailbox API's to just process messages from this mailbox, if you then need to update the original email write and Async process that find the message in the recipients mailbox and update that in the background.

    Cheers

    Glen

    • Marked as answer by Coder_N Wednesday, January 24, 2018 8:44 AM
    Sunday, January 21, 2018 11:06 PM
  • Thank you very much, Glen, for all the information. That was incredible helpful.

    One of our first ideas was also to poll all mailboxes with EWS. But it seemed kind of clumsy.

    Since a migration into the cloud is not on the table in foreseeable future, I think we will definitely try to implement a Transport Agent.

    Thanks Again!!

    Wednesday, January 24, 2018 8:39 AM