Trigger a script when emails are received in Exchange Online

emailexchangeonlinemicrosoft-office-365

Running Office 365 Business Premium.

Curious if this is possible or if there is a supported way to accomplish this.

I want to kick off a script when email is received by a specific recipient (actually a distribution list). The script will do something base on the IP of the sender. What are my options for accomplishing this? Is this info even available in Exchange Online?

I'm assuming the only way is to poll my Exchange online instance with Get-MessageTrace. Ideally I would like to have Exchange trigger the script somehow (maybe MS has some cloud service that does this?).

Best Answer

I would look at Microsoft Flow or PowerApps. Outside of the Microsoft stack there is also IFTTT and Zappier. These use webhooks to interact with Office 365, and email recipient is one of them. So you could trigger an event to save a message when you receive it from a recipient or a variety of other actions available in those apps.

You could of course also write your own Azure web job and utilize the Office 365 API to create a custom app to handle what you want.

Related Topic