I'm trying to set up an email connection to Exchange Online using Oauth (since basic auth will be retired soon
). I've tried following the guides for SMTP
and Exchange EWS
, but neither seem to mention Oauth; they look like they were written before that feature was available.
I've created my service principal in Azure AD, but I'm not sure what permissions it needed? I've given it an Application Permission of Microsoft Graph -> Mail.Send and granted admin consent; is that enough?
I've then entered the following info into a Visual Cron SMTP connection:
- Main Settings
- Address - smtp.office365.com
- Port - 587
- Authentication type - OAuth
- Use VisualCron registered app - not selected (I presume there's some way to define the registered app within Visual Cron, but I haven't found it yet, and am just trying to get this working here for now)
- Application ID - from the Service Principal
- Client Secret - from the App Registration
- Cryptographic protocol - TLS
- Security mode - Explicit
- Allowed SSL/TLS versions - TLS 1.2 & 1.3
- Extra settings
- Tenant ID - From Azure AD
- Tenant Name - From Azure AD
- Tenant Primary Domain - <Tenant Name>.onmicrosoft.com
However, it doesn't seem to be working. When I click "Test" and enter a to and from e-mail address, I get a popup window in Visual Cron saying "Failure -> Connection test failed. Error: Unhandled error: One or more errors occurred". I'm also not seeing any auth failures in the Azure AD Sign-In logs (under Service Principals), so I presume it's not even getting to the point of trying to authentication to Azure.
Can anyone help me?