ReconSnapshot--:--:--ZUTC

Email security · Guide

How to Fix an SPF Record

Most broken SPF records have one of four problems: more than one record, more than 10 DNS lookups, a missing sending service, or a weak all at the end. Check yours below, then fix them in that order.

By DarkFire Industries · Reviewed · How this guide was made

Problem 1: more than one SPF record

A domain may publish only one TXT record starting with v=spf1. Two records cause a permanent error. Merge them:

v=spf1 include:_spf.google.com -all
v=spf1 include:sendgrid.net -all
→ v=spf1 include:_spf.google.com include:sendgrid.net -all

Try it Validate an SPF record

Full tool: SPF Record Checker

Problem 2: too many DNS lookups

SPF allows at most 10 mechanisms that require DNS lookups, counted across every nested include. Above that, receivers return permerror and treat SPF as failed. To get back under:

  • Remove includes for services you no longer use.
  • Replace a and mx with the exact ip4: ranges if they rarely change.
  • Move bulk or marketing mail to a subdomain with its own SPF record.
  • Avoid manual "flattening" into IP lists unless you can keep them updated automatically; providers change their ranges.
How SPF lookups add upEach include, a, mx, exists and redirect costs one DNS lookup, including those inside included records. ip4 and ip6 are free. Above 10, SPF fails.v=spf1 ip4:203.0.113.0/24 include:_spf.mail.example include:crm.example mx -allip4:…0 lookups (free)include:_spf.mail…1 + 3 nested = 4include:crm…1 + 2 nested = 3mx1 lookupLookups used8 of 10 usedover 10 = permerror
How SPF lookups add up. Each include, a, mx, exists and redirect costs one DNS lookup, including those inside included records. ip4 and ip6 are free. Above 10, SPF fails.

Problem 3: a weak ending

+all authorizes every server on the internet; ?all makes no statement. Use ~all (soft fail) while you confirm every sender, then -all. With DMARC enforced, either works; -all is stricter.

Problem 4: legitimate mail fails SPF

Find the failing service in DMARC reports or message headers, then add the include its documentation specifies. SPF checks the envelope sender (Return-Path), so some services also need a custom return-path or bounce domain on your domain to align for DMARC.

Syntax mistakes

  • include: example.com with a space is invalid.
  • ip4: takes addresses or CIDR ranges, not hostnames.
  • Records over 255 characters must be split into several quoted strings in the same record; most DNS panels do this automatically.
  • ptr is discouraged by RFC 7208; replace it.

Verify the fix

Re-run the checker, confirm one record and 10 or fewer lookups, then send a test message and look for spf=pass in the Authentication-Results header.

See the whole picture

Run the full Recon Snapshot to check DNS, email authentication, certificates, hosting, exposed services, security headers and lookalike domains together, with a plain-English fix for every finding.

Run a full snapshot

References

  1. RFC 7208 — Sender Policy Framework (SPF)
  2. Microsoft Learn — Set up SPF to identify valid email sources
  3. Google — Email sender guidelines

About this guide

Drafted with AI assistance and checked against the primary sources listed above; its embedded tool was tested against live domains before publication. It was last checked on November 25, 2026; standards and provider requirements change, so confirm critical settings against the references. Found an error? Tell us.

Related guides