Based on Microsoft Graph REST API ( for more info see : [https://docs.microsoft.com/en-us/graph/api/resources/message?view=graph-rest-1.0]).\\

!!!Microsoft Graph Application registration
\\
It requires Microsoft Graph Application registration. Start at the Microsoft azure portal:\\
[https://azure.microsoft.com/en-us/features/azure-portal/]\\
\\
__Application registration__: Go to the App registrations and click on New registration:\\
\\
[attachments|new_registration.png]\\
\\
Name it. Select the Multitenant and personal Microsoft accounts type. The redirect url must ends with :register_microsoft_graph_api/. Then click on register.\\
\\
[attachments|register_app.png]
\\
__App permissions__ :\\
\\
MicrosoftMails task support OAuth 2.0 client credential grant. It requests the permissions from a directory admin. Go to the API permission. Click on Add permission, select Microsoft Graph.Choose "Application permissions".\\
\\
[attachments|permission_microsoft_graph.png]\\
\\