Microsoft is retiring Basic Authentication for Office 365. For details, see the official announcement: https://techcommunity.microsoft.com/blog/exchange/exchange-online-to-retire-basic-auth-for-client-submission-smtp-auth/4114750
Overview
To use OAuth with the Office 365 Mail provider, you will need to change the way emails are currently sent in your workflows. This approach requires creating two connectors:
These connectors can be invoked either from a subprocess or via a CAPI.
Below are the steps to accomplish this.
Azure AD Setup
1. Register an Application Go to Azure Portal → Azure Active Directory → App registrations → New registration and select Single tenant.
2. Grant Permissions
Go to API permissions → Add permission → Microsoft Graph → Application permissions and add: Mail.Send
Then click Grant admin consent.
3. Create a Client Secret Go to Certificates & secrets → New client secret.
Note: The access token has a configurable expiration time. We recommend selecting a long duration to avoid frequent updates. Copy the Value immediately after creation.
4. Retrieve Your Tenant ID Locate your Tenant ID from the Azure Active Directory overview page.
Get the Access Token
Token endpoint:
https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token
Request parameters:
client_id = YOUR_CLIENT_IDclient_secret = YOUR_CLIENT_SECRETgrant_type = client_credentialsscope = https://graph.microsoft.com/.defaultResponse:
{
"token_type": "Bearer",
"expires_in": 3599,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs..."
}
Send the Email
Use the access token in an HTTP connector to call Microsoft Graph.
Endpoint:
https://graph.microsoft.com/v1.0/users/sender@yourdomain.com/sendMail
Headers:
Authorization: Bearer ACCESS_TOKENContent-Type: application/jsonPayload:
{
"message": {
"subject": "Test mail",
"body": {
"contentType": "Text",
"content": "Hello from raw HTTP"
},
"toRecipients": [
{
"emailAddress": {
"address": "recipient@example.com"
}
}
]
}
}
Important Note
The sender user (sender@yourdomain.com) must: