'Office 365 mail relay engine using Graph API

I have a few mail boxes on Office 365, I'm trying to create my own mail filter application using the Microsoft Graph API.

Ive managed to get all my mailbox and to change them using the Graph API, but unfortunately Im able to do the filtering only after the mail is in the mailbox. How can I prevent from the mail to get in my mailbox before I test it? I'm looking for a solution without creating my own MTA. Is this possible using only the Microsoft Graph API?

My code is in python and im using the msal and request libraries to communicate with the servers.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source