Security Policy Errors

Add an On-Premises IPv4 Address to a Microsoft 365 SPF Record

Jason MillerJason Miller Nov 20, 2026 869 views

Question details

Authorize an on-premises mail server to send email for the same domain as Microsoft 365.

Product
Microsoft 365 and domain DNS
Device & OS
not provided
Scenario
An organization sends email for one domain through both Microsoft 365 and an on-premises mail server.
Observed behavior
The domain's SPF record should authorize both Microsoft 365 and the on-premises server's public sending IPv4 address.
Before you start

Identify the public IPv4 address recipients see when the on-premises server sends mail, and locate the domain's existing SPF TXT record in your DNS provider's portal. Check for any other legitimate sending services that must remain authorized.

Solution 1Recommended

Add the Server's Public IPv4 Address to the Existing SPF Record

Use one SPF TXT record to authorize the on-premises server and Microsoft 365 without removing other legitimate senders.

1
Open the DNS records

Sign in to your DNS provider's portal, select the sending domain, and open its DNS records or DNS management page.

2
Find the SPF TXT record

Locate the TXT record for the sending domain whose value begins with v=spf1. Edit that record rather than adding a second SPF record for the same domain.

3
Add the IPv4 mechanism

Add ip4: followed by the server's public sending address before the final all mechanism. For example, a record with no other senders could be: v=spf1 ip4:1.1.1.1 include:spf.protection.outlook.com -all. Replace 1.1.1.1 with your actual public address, and retain any other mechanisms needed by legitimate senders.

4
Save and verify

Save the TXT record in your DNS portal. After DNS changes propagate, query the domain's TXT records or use an SPF validation tool to confirm that one SPF record is published and its syntax is valid.

Add the Server's Public IPv4 Address to the Existing SPF Record
Keep Microsoft 365 authorized: Retaining include:spf.protection.outlook.com keeps Microsoft 365 authorized by SPF. The -all ending in the example rejects other sources for SPF purposes; review your existing policy before changing it.
Free Microsoft Office alternative

Document Your Email Configuration in WPS Office

SPF records are managed through your DNS provider, not WPS Office. For office documents, WPS Office is a free, lightweight alternative with a familiar interface and support for Microsoft Office formats, making it easy to move existing files.

Document SPF settings and mail-server changes in WPS WriterOpen and edit Microsoft Word DOCX and Excel XLSX filesUse a familiar interface for everyday office workWork with existing Office files in a lightweight suite
microsoft office alternative - wps office

Frequently Asked Questions

Will adding the on-premises IP address stop Microsoft 365 from sending mail?

It should not, as long as the existing SPF record retains include:spf.protection.outlook.com and is published correctly. Verify the saved TXT record with an SPF validation tool.

Can I create a separate SPF record for the on-premises server?

No. Publish only one SPF record for the same domain. Add the server's ip4 mechanism to the existing record in your DNS provider's portal.

Should I use the server's private or public IP address?

Use the public IPv4 address visible to receiving mail servers. If outbound mail passes through a gateway or NAT device, identify the public address used by that device.

What should I check if the updated SPF record fails validation?

Query the domain's TXT records and check for multiple SPF records, syntax errors, missing sender mechanisms, or excessive DNS lookups. SPF evaluation permits a maximum of 10 DNS-querying terms.