How to Use the SMTP Server for Office 365
Connecting applications, printers, and legacy software to the SMTP server for Office 365 requires configuring specific host settings, authentication protocols, and security layers to ensure reliable email delivery. To use this service, you must point your devi...
Connecting applications, printers, and legacy software to the SMTP server for Office 365 requires configuring specific host settings, authentication protocols, and security layers to ensure reliable email delivery. To use this service, you must point your device or application to the smtp.office365.com endpoint, enable STARTTLS on port 587, and provide valid credentials for a mailbox that has modern authentication protocols or authenticated SMTP enabled.
Contents
Understanding the Office 365 SMTP Architecture
Office 365 provides an SMTP relay service designed to allow devices and applications to send email messages through the Microsoft 365 infrastructure. When you utilize this server, your emails are routed through Microsoft’s security filters, ensuring that messages originating from your internal tools benefit from the same reputation and delivery standards as standard user-to-user communications.
The service is not a generic open relay; it is an authenticated gateway. For security reasons, Microsoft enforces strict identity verification. Attempting to connect without proper authentication will result in connection timeouts or access denied errors. Furthermore, administrators must ensure that the specific mailbox account being used has the "Authenticated SMTP" setting enabled within the Exchange Admin Center, as this is frequently disabled by default in modern security-hardened environments.
Prerequisites for Successful Configuration
Before attempting to configure your hardware or software, you must verify that your environment meets the requirements for a successful handshake. Attempting to connect without verifying these settings often leads to persistent failure, as the platform is designed to reject unencrypted or unauthenticated traffic.
- Exchange Online License: The mailbox used for authentication must possess an active license. Service accounts used strictly for SMTP relaying still require a user mailbox identity to function correctly.
- Authenticated SMTP Setting: Within the Microsoft 365 admin portal, locate the user’s mailbox properties, navigate to the "Mail" tab, and ensure "Authenticated SMTP" is toggled to "On."
- Multi-Factor Authentication (MFA) Considerations: If the account used for SMTP authentication has MFA enabled, standard password-based login will fail. You must generate an App Password or, preferably, utilize OAuth 2.0 if your application supports it.
- Security Defaults: If you have "Security Defaults" enabled at the tenant level, MFA is enforced globally. In such cases, using a dedicated service account without MFA, or using an App Password, is often required for legacy protocols.
Technical Configuration Specifications
When configuring your client, software, or printer, you must input the exact server details recognized by Microsoft's gateways. Using incorrect ports or encryption settings will cause a failure during the initial TLS negotiation.
| Setting | Configuration Value |
|---|---|
| SMTP Server | smtp.office365.com |
| Port | 587 |
| Encryption Method | STARTTLS |
| Authentication | OAuth 2.0 (preferred) or Basic Authentication |
| Username | Full email address (e.g., user@yourdomain.com) |
| Password | Mailbox password or App Password |
The most common point of failure is the encryption setting. Port 25 is generally blocked for direct submission to the Office 365 SMTP endpoint to prevent spam and relay abuse. Always prioritize port 587, which is the industry standard for secure email submission.
Handling Authentication and Security Layers
The evolution of security protocols means that basic authentication is increasingly restricted. Microsoft 365 pushes toward OAuth 2.0, which uses token-based authentication rather than raw passwords. If your application is modern and supports modern authentication libraries (such as the Microsoft Authentication Library, or MSAL), you should prioritize this method. It eliminates the need to store passwords in configuration files and provides a much higher security posture for your organization.
For legacy hardware—such as network scanners, printers, or older ERP systems that do not support modern OAuth flows—you must rely on basic authentication. In this scenario, you must use an App Password if the account has MFA enabled. An App Password acts as a long-lived, secondary credential that bypasses the second factor for specific, non-interactive applications.
Troubleshooting Common Connectivity Issues
If you receive a connection error, it is rarely due to the server being down; it is almost always a configuration mismatch between your client and the Exchange Online security requirements.
- Connection Timeout: This often indicates that a firewall or ISP is blocking outbound traffic on port 587. Check your local network firewall rules and ensure that your router allows communication to the smtp.office365.com address.
- Authentication Failed: This is the most common error. Verify the mailbox password. If MFA is active, the standard account password will not work for SMTP submission. You must use an App Password or switch to an application that supports modern authentication.
- Relay Denied/Access Denied: If your application is attempting to send mail as an alias or a different address than the one used for authentication, Exchange Online will reject the request. Ensure that the "From" address in your application matches the email address of the account providing the SMTP credentials.
Alternative Scenarios: SMTP Relay vs. Direct Send
It is important to distinguish between "Authenticated SMTP Submission" and "Direct Send." Authenticated SMTP is what we have discussed: sending mail as a user. However, if you are attempting to send mail from a printer that doesn't support TLS or authentication, you might consider "Direct Send."
Direct Send does not require a mailbox and does not use authentication; instead, it sends email directly to your Office 365 MX record. This requires that your printer has a static public IP address and that you have configured your SPF (Sender Policy Framework) record to authorize that IP address. This is significantly more complex to configure but is often the only path for hardware that lacks modern security features.
Next Steps for Implementation
To implement this successfully, begin by creating a dedicated service account specifically for these automated tasks. Avoid using personal or administrative email accounts, as credentials for these accounts may change, causing your automated systems to break.
- Create a user mailbox for "notifications" or "alerts."
- Enable "Authenticated SMTP" for this specific account.
- If using an application that supports modern auth, register the application in the Microsoft Entra admin center to retrieve a Client ID and Tenant ID.
- If using legacy hardware, configure an App Password for the account.
- Perform a test send and monitor the mailbox "Sent Items" folder to confirm that the messages are being processed correctly.
- Once validated, document the SMTP configuration in your internal IT knowledge base for future reference by your technical team.