How to Configure a Load Balancer to Relay SMTP Directly to Microsoft 365
Question details
The user needs to configure an Nginx load balancer to relay internal SMTP traffic directly to Exchange Online, but messages are failing because the load balancer cannot provide a certificate.

- Product
- Microsoft 365 / Exchange Online
- Device & OS
- not provided
- Scenario
- Setting up direct anonymous SMTP relay from an internal network through a load balancer to Exchange Online, bypassing on-premises Exchange servers.
- Observed behavior
- Relayed messages are being dropped because the Nginx load balancer cannot provide the required SSL/TLS certificate for Exchange Online connector authentication.
Verify that your Microsoft 365 subscription supports SMTP relay and gather your organization's authorized, static public IP addresses before configuring the connector.
Configure Microsoft 365 SMTP Relay Using a Public IP Address
Since the load balancer cannot provide a TLS certificate, configuring the Exchange Online connector to authenticate via your organization's authorized public IP address is the most reliable alternative.
Direct anonymous relay to Exchange Online requires a dedicated inbound connector. If your load balancer lacks a certificate for authentication, you must create a connector that validates the connection using an accepted domain and a static public IP address.
Log in to the Microsoft 365 Admin Center with administrator privileges, expand the navigation menu, and click on Exchange.
Navigate to Mail flow > Connectors. Click the '+' or 'Add a connector' button to create a new connector routing from your organization's email server to Microsoft 365.
Choose the option to identify your partner organization by verifying that the sender domain matches one of your accepted domains. In the authentication settings, enter the static, authorized public IP address of your load balancer or external firewall.
Access your domain's DNS settings and ensure your SPF (Sender Policy Framework) record includes the public IP address of the load balancer to prevent relayed messages from being marked as spam.

Use Authenticated SMTP Client Submission
If the devices routing traffic through the load balancer can authenticate individually, setting up authenticated SMTP submission bypasses the need for an IP-based anonymous relay connector.
Looking for a Lightweight Alternative to Microsoft Office?
Managing complex Microsoft 365 infrastructure like Exchange Online connectors and SMTP relays can be resource-intensive. If your primary need is simply a reliable, user-friendly, and cost-effective office suite for daily document tasks, WPS Office is an excellent choice. It delivers powerful productivity tools without the heavy IT administration overhead.
- 1. Download the Installer: Visit the official WPS Office website and download the free installation package for your Windows, Mac, or Linux operating system.
- 2. Install WPS Office: Run the downloaded installer and follow the simple on-screen instructions to complete the setup in minutes.
- 3. Open Your Documents: Launch WPS Office and immediately open your existing Microsoft Word, Excel, or PowerPoint files to continue working seamlessly.

Frequently Asked Questions
Why are my SMTP relay messages dropped when using an Nginx load balancer?
Messages are typically dropped if the load balancer attempts anonymous relay without providing a required TLS certificate, or if the source IP address is not authorized in an Exchange Online inbound connector.
Can I configure Microsoft 365 SMTP relay without a TLS certificate?
Yes. If your load balancer cannot provide a certificate, you can configure the Exchange Online connector to authenticate the relay connection using your organization's dedicated static public IP address.
Does direct anonymous SMTP relay work out-of-the-box with Exchange Online?
No. Direct anonymous relay requires a specifically configured inbound connector in the Exchange Admin Center to explicitly accept and route emails from your internal network.
Do I need to change my on-premises Exchange settings for this setup?
If your design strictly bypasses the on-premises Exchange servers and routes directly to Exchange Online via the load balancer, you only need to configure the Exchange Online connector and update your DNS (SPF) records.




