how do I modify DNS record in order to comply with SPF best practices.

Posse 0 Reputation points
2026-11-27T18:02:24.7466667+00:00

Messages are coming back undeliverable because DNS record does not comply with SPF best practices.

Microsoft 365 and Office | Subscription, account, billing | For business | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Marcin Policht 113.9K Reputation points MVP Volunteer Moderator
    2026-11-27T18:14:33.9133333+00:00

    Microsoft 365 has built-in SPF support. Microsoft maintains the authorized mail server infrastructure and provides an SPF mechanism that identifies which servers are permitted to send email on behalf of Microsoft 365 customers. However, SPF is not automatically published in your domain's public DNS. Your organization must publish the appropriate TXT record with your DNS hosting provider.

    For a domain that uses Microsoft 365 exclusively to send outbound email, the required SPF record is:

    v=spf1 include:spf.protection.outlook.com -all
    

    To configure it, sign in to the DNS hosting provider where your domain's public DNS records are managed. Locate the TXT records and find the existing SPF record, which begins with v=spf1. If one exists, modify it to match the record above. If no SPF record exists, create a new TXT record with the following settings:

    Type: TXT

    Host/Name: @ (root of the domain)

    Value: v=spf1 include:spf.protection.outlook.com -all

    TTL: Use the provider's default value.

    Do not create multiple SPF records. A domain must have only one SPF record. If multiple TXT records begin with v=spf1, receiving mail servers can return SPF validation errors. Also, if other systems send email using your domain, such as application servers, on-premises Exchange, or third-party email services, their authorized sending sources must be included in the same SPF record.

    The record contains three components. v=spf1 identifies the SPF version, include:spf.protection.outlook.com authorizes Microsoft's mail infrastructure to send email for your domain, and -all instructs receiving mail servers to treat messages from unauthorized sources as SPF failures. Microsoft maintains the underlying sending infrastructure, so you do not need to maintain individual Microsoft mail server IP addresses.

    After saving the DNS changes, allow time for propagation. You can verify the record using MXToolbox SPF Lookup. Confirm that the record resolves correctly, only one SPF record exists, and the SPF evaluation does not exceed the limit of 10 DNS lookups.

    You can also check your domain configuration in the Microsoft 365 admin center under Settings > Domains. Select your domain to review its DNS configuration and identify any reported issues.


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-11-27T18:03:06.47+00:00

    If Microsoft 365 Exchange Online is your domain’s only email sender, edit the domain’s existing SPF TXT record at your DNS hosting provider to v=spf1 include:spf.protection.outlook.com -all, ensuring that only one SPF record exists.

    Modify the SPF record

    SPF records cannot be managed in the Microsoft 365 admin center; they must be changed where your public DNS is hosted—typically your domain registrar or DNS provider.^1^

    1. Sign in to the provider that manages your domain’s DNS.
    2. Open DNS management, DNS records, or Zone editor.
    3. Locate every TXT record whose value begins with v=spf1.
    4. Keep one SPF record only:
      • If Microsoft 365 is the only service sending as your domain, set:
             Type: TXT
             Host/Name: @
             Value: v=spf1 include:spf.protection.outlook.com -all
             TTL: 3600
        
      • If an SPF record already exists, edit it rather than adding another. Multiple SPF records for the same domain cause an SPF permanent error (permerror). Microsoft recommends a minimum TTL of 3,600 seconds.^1^
    5. Save the record and allow time for the DNS change to propagate.

    If other systems also send email

    Do not use the Microsoft-only record if newsletters, CRM systems, website servers, help desks, on-premises mail servers, or other providers send messages using your domain. Add every legitimate source to the same SPF record before -all.

    For example:

    v=spf1 ip4:[IP Address] include:spf.protection.outlook.com include:mail.example -all
    

    Replace the sample IP address and provider domain with values supplied by the actual sending service. Microsoft documents this merged-record format for environments using Exchange Online plus other senders.^2^

    Keep these restrictions in mind:

    • Use exactly one SPF record per domain or sending subdomain.
    • Keep the SPF evaluation below 10 DNS lookups. An include: can cause one or more lookups; IP address entries do not.
    • Place -all at the end. It marks unlisted systems as unauthorized.
    • A sending subdomain needs its own SPF record; the parent domain’s SPF record does not cover it.^1^

    Verify against the bounce message

    After propagation, use a public DNS/SPF checker to confirm that:

    • Only one v=spf1 record is returned.
    • include:spf.protection.outlook.com is present.
    • The record has valid syntax and stays within the lookup limit.

    Then resend a test message and inspect the new non-delivery report.

    If its code is 550 5.7.23, Microsoft specifically associates that NDR with an SPF configuration issue. The email administrator should also check whether all sending domains are provisioned, any on-premises sending IPs are authorized, and the message was routed through Microsoft 365’s High Risk Delivery Pool.^3^

    If the bounce has another code—particularly one saying the recipient classified the message as spam—a correct SPF record might not resolve it. SPF authenticates the sending source but does not guarantee delivery. Configure DKIM and DMARC as well; Microsoft recommends using all three for custom domains.^1^

    If DNS is managed by another administrator or provider, send them the SPF value and ask them to merge it into the domain’s single existing SPF TXT record.


    References

    1. Set up SPF to identify valid email sources for your custom cloud domains
    2. External Domain Name System records for Microsoft 365
    3. Fix NDR error "550 5.7.23" in Exchange Online
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.