Data Protection Issues

Configure SPF and DKIM for an Exchange Online SMTP Relay

John WilsonJohn Wilson Nov 18, 2026 869 views

Question details

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

Configure SPF and DKIM for an Exchange Online SMTP Relay
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.
Before you start

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.

Solution 1Recommended

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.

1
Inspect the existing SPF record

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.

2
Add the appropriate senders

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.

3
Check the connector

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.

4
Test a delivered message

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.

Review the SPF record and Exchange Online connector
SPF depends on the delivery path: If Exchange Online delivers the message to the recipient, the recipient normally evaluates Microsoft's sending IP, not the external server's IP. Authorize the external IP when it also sends directly for the domain. Ensure the complete SPF record stays within the 10 DNS-lookup limit.
Free Microsoft Office alternative

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.

Organize opted-in recipient lists in WPS SpreadsheetsOpen and edit Microsoft Excel XLSX filesWork with Microsoft Word DOCX and PowerPoint PPTX filesUse a familiar interface for an easier move from Microsoft Office
microsoft office alternative - wps office

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.