0
votes

My goal is to develop an Exchange listener that will intercept the organization mail box for new mails and for each mail it would do some logic.

After i've researched the subject online - i saw that there are two primary ways to do that:

  1. Configure a new MTA (Mail Transfer Agent) that will be situated before the exchange server and will intercept the SMTP messages.

  2. Use EWS API to subscribe to a new mail event and run the login on the listener in this way i have 2 basic problems:

    • Is there a way to subscribe to all mailboxes on the exchange server? without looping all the users ?
    • How i can block a client to read his email before my listener handled it ? (can i move the whole incoming mail to a special default folder that the users wouldn't have an access to it - some king of hidden folder ?

Is there other way besides the two that i mentioned to fulfill the demand ?

Thanks!

1

1 Answers

0
votes

You can use a Transport Agent on Exchange https://technet.microsoft.com/en-us/library/bb125012(v=exchg.150).aspx which allows you to capture/proces messages while they are in the Transport pipeline. The advantage of this over what you have described in 1. is that you capture every message sent/received on the server including internal messages.

Is there a way to subscribe to all mailboxes on the exchange server? without looping all the users ?

No you need to managed your subscriptions per mailbox folder

How i can block a client to read his email before my listener handled it ? (can i move the whole incoming mail to a special default folder that the users wouldn't have an access to it - some king of hidden folder ?

All clients are equal on Exchange so you cant prioritise a client or block access to a new messages (you can block the client entirely) , in theory you could move all messages that arrive to NON_IPM_Root folder with an Inbox rule which means the user couldn't see them but you might want to consider the implications of what happens when your process fails, this could also be disabled by the user at any time when they create a Inbox rule themselves.