The Salesforce Email Relay feature doesn't support sending emails directly through Microsoft 365 Exchange (Exchange Online) to people outside of your organization and isn't recommended unless you have an on-prem or hybrid solution.
What errors might occur if I try to use email relay with Microsoft 365?
Microsoft 365, previously Office 365, needs to internally route and validate tenant emails that need to be relayed on to the Internet. Because of this requirement, some organizations can receive errors such as 'Relay Access Denied ATTR36' when emails are handed off to Microsoft message transfer agents (MTAs). This seems to be related to Microsoft's routing of email from shared IPs. Because of this, relaying email through Microsoft 365 can work inconsistently without the use of a standalone SMTP gateway for an organization's domain to pass email to an Microsoft 365 tenant.
Note: Sending mail to users within your organization should work with Email Relay. See Option #2 on this Microsoft document:
https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365
The workaround to send mail to people outside your organization is as follows:
1) SMTP Auth option in Salesforce (Being deprecated by Microsoft beginning December 2026 and completing by the second half of 2027, (previously March 2026))
2) Without SMTP Auth, use standalone SMTP gateway or Exchange On-Premise (Hybrid) with Salesforce Email Relay https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365#smtp-relay-configure-a-connector-to-relay-email-from-your-device-or-application-through-microsoft-365-or-office-365
3) Use Salesforce ‘Send Through External Services’ feature.
NOTE: Currently, the Email Relay feature doesn't support sending emails through Microsoft's Azure Communication Services and we are unable to recommend this as a workaround. This is due to the hostname (smtp.azurecomm.net) resolving to a CNAME, which is not supported for relaying with TLS enabled.
Salesforce Help - Send Email Through Email Relay
Idea Exchange - SMTP AUTH using OAUTH 2.0
000387487

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.