How to Set Office 365 SMTP Relay Settings: Step-by-Step Guide
To set up Microsoft Office 365 SMTP relay settings, you must choose one of three supported methods based on your application's sending requirements: SMTP AUTH Client Submission, Direct Send, or an Exchange Online Inbound Connector relay. Each option requires s...
To set up Microsoft Office 365 SMTP relay settings, you must choose one of three supported methods based on your application's sending requirements: SMTP AUTH Client Submission, Direct Send, or an Exchange Online Inbound Connector relay. Each option requires specific endpoint addresses, firewall ports, authentication credentials, and DNS configurations (SPF, DKIM, and DMARC) to route transactional and automated emails reliably.
Contents
Understanding Microsoft 365 SMTP Sending Options
Configuring automated email delivery from multi-function printers, line-of-business applications, network monitoring devices, and web servers through Microsoft 365 (formerly Office 365) requires selecting the appropriate relay architecture. Microsoft provides three primary methods for sending mail through Exchange Online, each tailored to specific operational requirements, security policies, and target recipient constraints.
| Method | Target Audience | Authentication / Port |
|---|---|---|
| Option 1: SMTP AUTH | External & Internal | Port 587 (TLS) / User Account |
| Option 2: Direct Send | Internal Only | Port 25 / IP-based (MX) |
| Option 3: M365 SMTP Relay | External & Internal | Port 25 (TLS) / IP Connector |
Selecting the incorrect option frequently leads to connection timeouts, rejected messages, or severe email deliverability failures. Below is a detailed breakdown of how each option functions:
- SMTP AUTH Client Submission: Connects devices directly to Microsoft 365 using a specific user account's credentials. It supports sending to both internal organization addresses and external recipients. However, it requires a dedicated licensed mailbox (or shared mailbox with appropriate permissions) and is subject to strict per-minute and per-day sending limits.
- Direct Send: Routes messages directly to your domain's Exchange Online Mail Exchange (MX) endpoint over Port 25. This option does not require user authentication or specialized licensing, but it only allows sending to recipients inside your tenant. External mail delivery is strictly blocked under Direct Send.
- Microsoft 365 SMTP Relay (Inbound Connector): Uses an IP-restricted or certificate-validated Inbound Connector configured inside the Exchange Admin Center (EAC). This method allows unauthenticated applications or devices originating from trusted public IP addresses to relay messages through Microsoft 365 to both internal and external domains.
Prerequisites and Tenant Security Considerations
Before modifying your network or Exchange Online configuration, review key security protocols and account permissions across your tenant:
- Administrative Privileges: You must hold the Exchange Administrator or Global Administrator role within Microsoft 365 to create Exchange connectors, alter tenant-wide transport settings, or manage mailbox-level SMTP authentication settings.
- Static Public IP Address: Both Direct Send and Connector-based SMTP Relay require your sending devices or servers to route outbound traffic through a fixed, static public IPv4 or IPv6 address. Dynamic residential or commercial IP ranges are routinely blocked by Microsoft Spam filtering.
- Firewall Port Availability: Ensure outbound network traffic is unblocked on Port 587 (for SMTP AUTH) or Port 25 (for Direct Send and Connector Relay). Many commercial Internet Service Providers (ISPs) and cloud providers block outbound Port 25 by default to mitigate spam propagation.
- Modern Authentication vs. SMTP AUTH: While Microsoft has disabled legacy Basic Authentication across tenant protocols, authenticated client submission (SMTP AUTH) remains functional when explicitly enabled for specific mailboxes or tenant-wide settings using OAuth 2.0 or app-specific controls.
Option 1: Setting Up SMTP AUTH Client Submission
SMTP AUTH Client Submission connects an individual application or device to Exchange Online using standard TLS encryption and a valid user credential. This method is ideal for low-volume applications, third-party software requiring account-based audit trails, or devices located off-site without a static public IP.
Technical Parameters
- Server/Host Name:
smtp.office365.com - Port:
587(Recommended) or25 - Encryption:
STARTTLSorTLS(Explicit TLS) - Authentication: Required (Valid Microsoft 365 User Credentials)
Step 1: Enable SMTP AUTH in Exchange Online
By default, SMTP AUTH may be disabled globally across your tenant. You must explicitly allow SMTP AUTH for the dedicated sending account.
- Log into the Exchange Admin Center.
- In the left navigation menu, navigate to Recipients > Mailboxes.
- Click on the target mailbox designated for sending automated emails.
- In the flyout panel, select the Mail flow settings tab (or Email apps under settings depending on your admin center interface).
- Click Manage email apps.
- Ensure the checkbox for Authenticated SMTP is checked.
- Click Save changes.
Alternatively, enable SMTP AUTH via Exchange Online PowerShell:
Set-CASMailbox -Identity "scanner@yourdomain.com" -SmtpClientAuthenticationDisabled $false
Step 2: Configure the Device or Application
Enter the standard parameters in your device or software interface:
- SMTP Server:
smtp.office365.com - Port:
587 - TLS/SSL Security: Enable TLS / STARTTLS
- Username: The full UPN of the mailbox (e.g.,
scanner@yourdomain.com) - Password: The account password (or App Password if Multi-Factor Authentication is enforced)
Limitations of SMTP AUTH
- Rate Limits: Limited to 30 messages per minute per mailbox and 10,000 daily recipients.
- MFA Restrictions: If Multi-Factor Authentication (MFA) or Conditional Access policies require interactive authentication, standard basic credentials will fail unless excluded via Conditional Access policies or authenticated via OAuth 2.0.
Option 2: Setting Up Direct Send
Direct Send allows devices on your local network to submit mail directly to Microsoft 365 protection servers without authenticating a specific user account. It is simple to implement but restricted entirely to internal communication.
Technical Parameters
- Server/Host Name: Your domain's MX Record endpoint (e.g.,
yourdomain-com.mail.protection.outlook.com) - Port:
25 - Encryption: TLS / STARTTLS (Recommended)
- Authentication: None / Anonymous
Step 1: Locate Your Domain's MX Record
- Sign in to the Microsoft 365 Admin Center.
- Go to Settings > Domains.
- Select your primary domain.
- Click on the DNS records tab and locate the MX (Mail Exchanger) record value. It typically follows the format:
yourdomain-com.mail.protection.outlook.com.
Step 2: Update Your Domain's Sender Policy Framework (SPF)
Because Direct Send originates mail from your local network's public IP address without user login credentials, Microsoft 365 inspects the sending IP against your domain's SPF record.
- Log into your external DNS hosting provider (e.g., Cloudflare, GoDaddy, Azure DNS).
- Edit your domain's existing TXT SPF record.
- Add your public static IP address using the
ip4:syntax before the terminal mechanism (such as-allor~all).
v=spf1 ip4:203.0.113.10 include:spf.protection.outlook.com -all
Step 3: Apply Settings to Your Device
Configure your local application or hardware device with the following parameters:
- SMTP Host:
yourdomain-com.mail.protection.outlook.com - Port:
25 - Authentication: Off / None
- Sender/From Address: Any valid email address utilizing your custom domain (e.g.,
alerts@yourdomain.com).
Option 3: Setting Up Microsoft 365 High-Volume SMTP Relay (Inbound Connector)
When an application must send emails to both internal staff and external clients—and cannot perform user authentication over SMTP AUTH—you must configure an Inbound Connector in Exchange Online. This is the standard enterprise solution for line-of-business applications, web platforms, and automated workflow engines.
- On-Premises Server (IP: 203.0.113.10)
- Sends traffic via Port 25 (TLS), validated by Connector
- Exchange Online (Inbound Connector)
- Internal & External Recipients
Technical Parameters
- Server/Host Name: Your domain's MX Record endpoint (
yourdomain-com.mail.protection.outlook.com) - Port:
25 - Encryption: TLS 1.2 or higher required
- Authentication: IP Address or Subject Alternative Name (SAN) Certificate Validation
Step 1: Create the Inbound Connector in Exchange Admin Center
- Open the Exchange Admin Center.
- Navigate to Mail flow > Connectors.
- Click Add a connector.
- Under Connection from, select Your organization's email server.
- Under Connection to, Microsoft automatically defaults to Office 365.
- Select Connector Source
- From: Your organization's email server
- To: Office 365
- Click Next.
- Name the connector (e.g.,
App_Relay_Static_IP) and provide a clear description. Keep Turn it on checked, then click Next. - Select the authentication mechanism:
- By verifying that the IP address of the sending server matches one of these IP addresses: Choose this option and enter your network's static public IPv4 address (e.g.,
203.0.113.10). - By verifying that the certificate name matches: Choose this if your sending server uses a public commercial SSL/TLS certificate to identify itself.
- By verifying that the IP address of the sending server matches one of these IP addresses: Choose this option and enter your network's static public IPv4 address (e.g.,
- Click Next, review the configuration settings, and click Create connector.
Step 2: Configure Public DNS Records (SPF & DKIM)
To ensure relay traffic passes modern anti-spam and spoofing filters across external recipient domains, update your DNS entries:
- Update SPF Record: Append your sending server's static public IP to your SPF TXT record:
v=spf1 ip4:203.0.113.10 include:spf.protection.outlook.com -all - Configure DKIM (DomainKeys Identified Mail): Ensure your sending application natively signs outbound messages using DKIM keys generated for your domain, or route through an intermediary MTA configured to attach valid signature headers.
Side-by-Side Method Comparison
Use the detailed technical matrix below to determine the optimal Microsoft 365 SMTP delivery method for your environment:
| Technical Criteria | Option 1: SMTP AUTH | Option 2: Direct Send | Option 3: M365 SMTP Relay |
|---|---|---|---|
| Primary Server Endpoint | smtp.office365.com |
Your MX Endpoint (*.mail.protection.outlook.com) |
Your MX Endpoint (*.mail.protection.outlook.com) |
| Supported Ports | 587 (or 25) | 25 | 25 |
| Transport Layer Security | STARTTLS / Explicit TLS | TLS Optional (Recommended) | TLS Mandatory |
| Authentication Requirement | User Credentials (UPN + Password) | None | IP Address or SAN Certificate |
| Recipient Capability | Internal & External | Internal Only | Internal & External |
| Licensing Requirement | Requires M365 Mailbox License | No License Required | No License Required |
| Static Public IP Needed? | No | Yes | Yes |
| Sending Volume Limitations | 30 msg/min; 10,000 recipients/day | Tenant recipient limits apply | Subject to service throttling policies |
| Sender Address Constraint | Must match authenticated account | Any domain address in tenant | Any domain address in tenant |
Authentication and DNS Verification (SPF, DKIM, DMARC)
Modern email security standards rely heavily on DNS records to authenticate senders. Misconfigured security records cause relayed emails to land in recipient Junk folders or be rejected outright by remote mail servers.
1. Sender Policy Framework (SPF)
An SPF record tells receiving mail servers which IP addresses and services are authorized to send mail on behalf of your domain.
- Example syntax containing multiple IPs and M365:
v=spf1 ip4:198.51.100.45 ip4:203.0.113.10 include:spf.protection.outlook.com -all - Caution: Domains must strictly enforce a limit of 10 DNS lookups within their SPF record. Relying on nested
include:directives can easily break SPF validation.
2. DomainKeys Identified Mail (DKIM)
DKIM provides a cryptographic signature attached to the header of relayed emails.
- Enable DKIM for your custom domains directly within the Exchange Admin Center under Mail flow > DKIM.
- Ensure two CNAME records are added to your DNS zone pointing
selector1._domainkeyandselector2._domainkeyto Microsoft 365 key targets.
3. Domain-based Message Authentication, Reporting, and Conformance (DMARC)
DMARC establishes how receiving servers should handle messages that fail SPF or DKIM checks.
- A basic reporting DMARC policy:
v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com; pct=100 - Once your relay pathways are thoroughly validated, transition your policy from
p=nonetop=quarantineorp=rejectto prevent domain impersonation.
Troubleshooting Common Office 365 SMTP Relay Errors
When configuring SMTP relay settings, administrator logs often expose specific error messages or diagnostic SMTP codes. The table below outlines root causes and operational remedies:
1. Error: 550 5.7.60 SMTP; Client does not have permission to send as this sender
- Root Cause: The sending application is using Option 1 (SMTP AUTH), but the "From" address specified in the message header does not match the authenticated account UPN, and the account lacks "Send As" rights.
- Solution: Change the application's "From" address to match the logged-in user, or grant explicit Send As permissions on the target mailbox using the command:
Add-RecipientPermission -Identity "sales@yourdomain.com" -Trustee "scanner@yourdomain.com" -AccessRights SendAs
2. Error: 535 5.7.139 Authentication unsuccessful
- Root Cause: SMTP AUTH is disabled tenant-wide or specifically for the user account, or the user is protected by Multi-Factor Authentication without using an App Password or OAuth token.
- Solution: Verify that SMTP AUTH is enabled on the individual mailbox via
Set-CASMailbox, and ensure Conditional Access policies allow basic authentication for this specific identity.
3. Error: 550 5.7.1 Relaying denied / Unable to relay
- Root Cause: An application attempted to send an email to an external recipient using Direct Send (Option 2) or an improperly configured Inbound Connector (Option 3).
- Solution: Verify the sender's public static IP matches the IP range configured in the Exchange Online Inbound Connector. Ensure the Connector type is explicitly set to Your organization's email server.
4. Connection Timeout on Port 25 or Port 587
- Root Cause: Local perimeter firewalls, cloud security groups, or ISP outbound blocks are preventing communication over the requested port.
- Solution: Run a diagnostic PowerShell test command from the sending machine to verify connectivity:
Test-NetConnection -ComputerName yourdomain-com.mail.protection.outlook.com -Port 25
Frequently Asked Questions
Can I use a shared mailbox for SMTP AUTH Client Submission?
Yes, you can use a shared mailbox for SMTP AUTH submission; however, shared mailboxes in Microsoft 365 are disabled for direct interactive login by default and do not possess a password. To use a shared mailbox for SMTP AUTH, you must either assign a license and enable the account password, or log in using a licensed user account that has explicit Send As permissions granted over the shared mailbox.
Why are emails sent via Direct Send landing in external recipient junk folders?
Direct Send is not designed or supported for external delivery. If you attempt to send to external recipients using Direct Send, Microsoft 365 will either reject the message outright with a relay denial error or fail SPF/DKIM checks on the recipient end. Use Option 3 (Inbound Connector SMTP Relay) for reliable delivery to external addresses.
What should I do if my ISP blocks outbound traffic on Port 25?
If your Internet Service Provider or cloud host (such as Microsoft Azure or AWS) blocks outbound Port 25, you cannot use Direct Send or IP-based Inbound Connector Relay directly. You must instead use Option 1 (SMTP AUTH) on Port 587, or deploy an intermediate cloud email service (such as Azure Communication Services, SendGrid, or an on-premises Exchange Hybrid server) capable of smart-hosting outbound mail.
How do Microsoft 365 High Volume Email (HVE) features impact relay settings?
Microsoft offers High Volume Email (HVE) features designed specifically for internal line-of-business applications that exceed standard tenant sending limits. HVE uses dedicated endpoints and custom admin controls within Exchange Online to support high-volume internal transactional mail without running into traditional rate throttling.
Strategic Next Steps for Implementation
To successfully deploy and stabilize your Microsoft 365 SMTP relay setup, follow this practical checklist:
- Audit Your Sending Applications: Identify all printers, line-of-business applications, and servers requiring email sending capability. Note their public IP addresses and destination requirements (internal-only vs. external).
- Select the Matching Relay Option: Use Option 1 for remote or low-volume devices needing external reach; use Option 2 for simple internal alert scripts; use Option 3 for high-volume enterprise systems.
- Configure Network Security & Firewalls: Ensure outbound rules permit traffic over Port 587 or Port 25 to Microsoft endpoints.
- Update Core DNS Records: Update your public SPF record to contain all authorized sending public IPs, and ensure DKIM keys are fully published.
- Conduct Test Transmissions: Send test messages to both internal and external test accounts. Inspect raw internet headers (
Authentication-Results) using header analyzer tools to verify that SPF, DKIM, and TLS encryption pass successfully.