Configure SPF and DKIM for an Exchange Online SMTP Relay
Question details
Confirm how to authorize an external SMTP server in SPF and whether DKIM is needed for relay through Exchange Online.

- Product
- Microsoft Exchange Online
- Device & OS
- not provided
- Scenario
- An external SMTP server sends opted-in logistics messages in bulk through an Exchange Online connector.
- Observed behavior
- The connector and a basic SPF record appear to work, but the administrator wants to verify the DNS and authentication settings.
Identify the public sending IP, the envelope sender domain, and every legitimate service that sends mail for that domain. Check whether Exchange Online delivers the messages to recipients or whether another service sends them directly.
Review the SPF record and Exchange Online connector
Use this approach to authorize the actual sending services and verify that the relay accepts mail from the external server.
In your DNS provider's dashboard, open the TXT records for the envelope sender domain. Keep a single SPF record for that domain and list the legitimate services and public IPs that recipients may see sending mail for it.
Edit the existing SPF TXT record to include the external server's public IP if it sends directly to recipients, and include spf.protection.outlook.com if Microsoft 365 sends for the domain. For example, use "v=spf1 ip4:YOUR_PUBLIC_IP include:spf.protection.outlook.com ~all", replacing YOUR_PUBLIC_IP with the actual public IPv4 address. Do not use a private address such as 10.5.3.2.
In the Exchange admin center, open Mail flow > Connectors and review the connector that accepts mail from your organization's email server. Confirm that its certificate or static public IP identification matches the external server and that the server sends to the domain's Microsoft 365 MX endpoint on port 25.
Send a test message to an external mailbox and inspect its message headers or authentication results. Confirm which IP delivered the message, which domain SPF checked, and whether SPF passed.

Enable DKIM for the domain and verify bulk-mail delivery
Use DKIM to strengthen message authentication; it is not required to authenticate the SMTP relay connector itself.
Prepare bulk-message recipient lists with WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface and compatible file formats for moving existing documents and spreadsheets. Use WPS Spreadsheets to organize recipient lists; Exchange Online still manages the SMTP connector, SPF, and DKIM.

Frequently Asked Questions
Does an Exchange Online SMTP relay require DKIM?
No. DKIM is not required to authenticate the relay connector. You can enable it for the sending domain in the Microsoft Defender portal to help recipients authenticate messages.
Should I put my external server's IP in the SPF record?
Add its public IP if it sends directly to recipients for the SPF domain. If Exchange Online delivers the message, recipients normally check Microsoft's sending IP instead. Check a delivered message's authentication headers to confirm the path.
Can I create a second SPF TXT record for the same domain?
No. Edit the existing SPF TXT record in your DNS provider's dashboard to include all legitimate senders. Multiple SPF records for the same domain can cause SPF evaluation errors.
Why can DMARC fail even when SPF passes?
SPF may pass for an envelope sender domain that does not align with the visible From domain. DMARC needs an aligned SPF or DKIM pass; inspect the message's authentication results and sending domains.
What should I check if bulk messages are filtered?
Inspect message headers for SPF and DKIM results, check the sending IP and domain against relevant blocklists, and review Microsoft's bulk-mail and Higher Risk Delivery Pool guidance.




