How to Configure Microsoft 365 SMTP Relay for Website Email
Question details
Configure an Exchange Online SMTP relay so a website can send outgoing messages using a custom Microsoft 365 domain address.

- Product
- Microsoft 365 / Exchange Online
- Device & OS
- not provided
- Scenario
- Setting up a secure email routing connection for a website or web application to send automated emails using a Microsoft 365 custom domain.
- Observed behavior
- Creating a mail flow connector, locating the correct MX record for the SMTP server, and configuring SPF to ensure email deliverability.
Ensure you have Exchange Administrator permissions in Microsoft 365 and obtain the static public IP address or TLS certificate details of the web server hosting your website.
Set Up SMTP Relay via Exchange Admin Center
Configure a mail flow connector using your static IP or certificate to relay emails securely from your website to Microsoft 365.
Microsoft 365 SMTP relay allows your web servers, applications, or multi-function devices to send emails using your custom domain. This method avoids the need for a licensed mailbox for the sender address, provided your domain is verified in the Microsoft 365 tenant.
Log in to the Exchange admin center. In the left navigation menu, go to Mail flow > Connectors. Click on 'Add a connector' and select 'Your organization's email server' as the source.
Give the connector a recognizable name and proceed to the authentication step. Choose to authenticate using a trusted TLS certificate or by entering the static public IP address of your web server. Review your settings and save the connector.
Open the Microsoft 365 admin center and navigate to Settings > Domains. Select your domain, then click on 'DNS records'. Find the MX record (e.g., yourdomain-com.mail.protection.outlook.com). This will serve as your SMTP server address.
In your website or application's email configuration panel, enter the MX record address as the SMTP host. Set the SMTP port to 25 and disable SMTP authentication if relying on IP-based routing.
To prevent your relayed emails from being marked as spam, log in to your domain's DNS hosting provider. Update your domain's SPF record to include the public IP address of your web server (e.g., v=spf1 ip4:10.5.3.2 include:spf.protection.outlook.com ~all).

Enhance Your Workflow with WPS Office
While managing Microsoft 365 configurations like SMTP relays, you can streamline your daily document tasks with WPS Office. It provides a lightweight, free, and highly compatible alternative to Microsoft Office for writing server documentation, managing configuration spreadsheets, and creating presentations.
- 1. Download the software: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install WPS Office: Run the setup file and follow the quick on-screen instructions to install the suite on your device.
- 3. Start working instantly: Open WPS Office to immediately start creating or editing Word, Excel, or PowerPoint files without any compatibility issues.

Frequently Asked Questions
What port should I use for Microsoft 365 SMTP relay?
When configuring an SMTP relay utilizing an Exchange mail flow connector, you should configure your web server or application to route outgoing emails over Port 25.
Why are emails sent from my website going to the spam folder?
This typically occurs if your Sender Policy Framework (SPF) record is incorrectly configured. You must ensure that the static public IP address of your web server is explicitly added to the SPF record of your Microsoft 365 domain.
Do I need a paid Microsoft 365 license for the sender address when using SMTP relay?
No. When using an IP-based or certificate-based connector for SMTP relay, the specific sender email address does not require an active Exchange Online license, provided the domain used in the 'From' address is verified in your tenant.




