How to Configure SPF Records the Right Way

Learn how to configure SPF records for single senders, multiple ESPs, and subdomains. Includes syntax, lookup limits, -all vs ~all, and testing steps.

How to Configure SPF Records the Right Way
Do not index
Do not index
Open rates collapse for a reason that has nothing to do with subject lines. A campaign can be well written, technically sound, and still land in spam because the domain's SPF record is missing, duplicated, bloated, or out of date. When that happens, inbox placement drops, sender reputation takes a hit, and the next send starts from a worse position than the last.
That's why a configure SPF record task should never be treated like a quick DNS edit. SPF is the first authorization check many receivers use, and it is a core input for DMARC alignment. If the record breaks, the domain looks unreliable even when the message content is fine. If the record is incomplete, a legitimate sender gets blocked, and the business feels it in missed revenue, weaker trust, and noisy support complaints.
notion image
Table of Contents

Why SPF Breaks More Often Than It Should

A marketer notices the pattern first. The transactional stream still arrives, but a campaign that used to reach the inbox starts drifting into junk, and Gmail's preview flags the sender as suspicious. The content hasn't changed, the list quality hasn't changed, but the authentication layer beneath the send has.
SPF, or Sender Policy Framework, tells receiving mail servers which senders are allowed to use a domain. If the sender isn't authorized, the recipient system can treat the message as untrusted, then feed that result into inbox placement and DMARC decisions. RFC 7208 also makes clear that SPF is published in DNS as a TXT record, not as a separate SPF record type, so a mispublished record can fail before the message is even evaluated properly. The standard also allows at most 10 DNS-mechanism lookups during evaluation, and crossing that ceiling returns PermError, which means authentication failure for the domain's mail. RFC 7208

The business cost shows up fast

A broken SPF record rarely announces itself with a dramatic outage. It usually appears as soft damage, lower inbox placement, weaker campaign engagement, and more support tickets asking why legitimate mail is missing. That's why deliverability teams treat SPF as part of sender reputation management, not a one-time DNS chore.
Mail providers also expect the record to be published correctly and to cover every authorized source. The result is simple, but the operational reality isn't. A single domain might send from marketing platforms, transactional systems, support tools, recruiter platforms, and subdomains no one remembered to inventory. SPF lookup best practices
That's the heart of the problem. SPF breaks because companies keep adding mail sources long after the original record was published. The record becomes a living dependency, and every new vendor, subdomain, or migration introduces another chance to fail authentication and lose inbox placement.

SPF Syntax and Record Structure Explained

A valid SPF record is not a mystery string. Read it left to right and the structure becomes manageable. The record starts with v=spf1, lists the allowed sending methods, then ends with a policy that tells receivers what to do with everything else. The part that breaks records is rarely the opening tag, it is the inventory behind it, because every added sender, vendor, and subdomain has to fit under the lookup limit and stay current.

How to read the parts

The common mechanisms are the ones deliverability teams use.
  • ip4 and ip6 authorize fixed address ranges.
  • a authorizes the domain's A record.
  • mx authorizes the MX hosts.
  • include imports another domain's SPF policy.
  • redirect hands evaluation off to a different record.
Qualifiers change how the receiver interprets the final result. - means hard fail, ~ means soft fail, ? means neutral, and the unqualified pass case is effectively permissive. Microsoft's setup guidance uses the standard v=spf1 <valid mail sources> <enforcement rule> structure, which is the right mental model to keep. Microsoft SPF setup guidance

Three working patterns

A simple Workspace-style sender often ends with a soft policy during rollout, for example, a single sender source plus ~all. A multi-sender domain adds one or more include mechanisms for approved platforms. A delegated setup can use redirect= when one curated record should own the entire decision set.
The publication rule matters just as much as the syntax. RFC 7208 requires SPF to be published as a DNS TXT record only, and setup guides from major providers also warn against duplicate SPF TXT records at the same hostname because duplicate records break validation. SPF TXT record setup guidance
For teams checking their own deployment, Mailadept's email authentication guide is useful for comparing SPF syntax against the rest of the stack.

The 10 Lookup Limit and How to Stay Under It

SPF records fail in production more often than teams expect. The hard ceiling is 10 DNS-mechanism lookups during SPF evaluation. Go past it and the receiver returns PermError, which means SPF fails for the domain. Keep that number in your head while you work, because a record that looks tidy can still break once receivers expand every nested reference.

Count the cost before you add a vendor

Every include, a, mx, ptr, exists, and redirect can consume lookups. The risk is not the visible record alone. One include can point to another record, that record can point to another vendor, and the count climbs fast. PowerDMARC's guidance says the same thing plainly, check the lookup count before you rely on the record and keep nested chains as short as possible. PowerDMARC SPF guidance
The decision process should be blunt.
  • Consolidate vendors when one platform duplicates another.
  • Flatten carefully when a provider publishes stable IP ranges and you can keep them current.
  • Use redirect= when one internal record should own the inventory.
  • Prune dormant senders before you add anything new.

Audit the record before it breaks

Start with the published TXT value, then expand each nested reference until you can see the full lookup budget. That is the only way to know whether the record still fits after the next platform gets added. If the record is already crowded, one more sender can push it into failure.
Treat SPF as a live inventory, not a one-time setup task. Mailwarm's guide on overcoming SPF record constraints is useful when the tree is getting hard to manage, because the problem is usually sender sprawl, not the syntax itself.
For a live check after DNS changes, MailAdept's spf record checker gives you a practical sanity check before you let the record sit in production.

Choosing -all or ~all for Your Use Case

The ending policy is not a style choice, it's an operational decision. -all is strict, ~all is tolerant, and ?all is effectively a shrug. M3AAWG recommends ending the record with ~all or -all, while Google's basic Workspace example uses ~all, which tells you the right choice depends on how much mail a team can afford to block during testing. M3AAWG SPF best practices
Use case
Recommended ending
Rollout path
Operational risk
Transactional-only domain
-all after validation
Start softer, then harden
Missing a sender breaks critical mail
Marketing stack with seasonal ESPs
~all during change windows
Tighten after each vendor review
Forgotten tools create false fails
Recruiter and outbound systems
~all until the tool inventory is clean
Move to -all only when stable
Rotating tools are easy to miss
Live domain migration
~all while traffic shifts
Reassess after the cutover
Mixed sources make hardfail risky

Pick the policy by failure mode

A transactional domain should usually move to hardfail quickly because the sender list is small and stable. Marketing teams have a different problem, because seasonal campaigns, temporary tools, and agency platforms create churn. Outbound and recruiting stacks are the messiest of all, since tools change often and nobody enjoys chasing every forgotten sender through DNS.
The safe rollout pattern is to begin with ~all, watch for unknown senders in DMARC reporting, then tighten to -all once the inventory is clean. That protects inbox placement while the team is still validating coverage. If a legitimate sender gets left out, a soft policy buys time to fix the record before the domain starts failing mail.
MailAdept's dmarc checker becomes useful here because SPF policy decisions are only half the story, DMARC reports are what expose the senders the SPF record missed.

Publishing, Testing, and Aligning With DKIM and DMARC

The deployment step is where teams usually expose their weak process. Publish the SPF TXT record at the domain apex or the relevant subdomain, and keep one SPF record per domain or subdomain. Microsoft, Google, and M3AAWG all push the same operational rule. Extra SPF TXT records should be removed, and each sending domain or subdomain needs a single authoritative value. Microsoft SPF setup guidance

Verify before and after publication

A disciplined rollout is boring, and that is the point.
  1. Add the TXT record in DNS.
  1. Confirm the published value with a DNS lookup tool.
  1. Send a live test message.
  1. Read the Authentication-Results header.
  1. Compare the visible From address against the SPF and DMARC results.
Do not trust a DNS editor screenshot. Check the record after it propagates, then test the exact mail path that will send production mail. A passing header shows spf=pass. A broken or overloaded record can surface as PermError. If there is no usable result, the header may show none, which means the receiver did not get a valid SPF evaluation to work with. The only test that matters is the one tied to the sender, because that is the path mailbox providers will judge.

SPF alone does not complete the authentication stack

DKIM signs the message so the receiver can tell whether the content changed in transit. DMARC connects SPF and DKIM to the visible brand identity and tells mailbox providers what to do when alignment fails. SPF without DKIM leaves too much weight on DNS authorization alone. SPF without DMARC leaves no policy layer to enforce the result. That is why deliverability teams set the stack in order as SPF first, DKIM second, DMARC last.
If the authentication stack is spreading across business units, a platform like WebinOne can help teams manage email accounts in WebinOne while the DNS ownership is being cleaned up, but the record itself still has to stay under one accountable owner.
MailAdept's dmarc checker is useful here because SPF policy decisions are only part of the picture. DMARC reports show which senders the SPF record missed, which ones are failing alignment, and whether the live inventory matches the DNS record you think you published.
The practical point is blunt. If SPF is broken, DMARC has incomplete input. If DKIM is missing, SPF has to carry too much of the load. If both are weak, inbox placement turns into guesswork.

Common SPF Mistakes That Break Delivery

The failures MailAdept sees in audits are rarely exotic. They're repetitive, predictable, and expensive because they hit live mail streams, not lab environments. Most of them are governance failures disguised as DNS problems.

The usual suspects

  • Duplicate TXT records at the same hostname. Microsoft explicitly warns to keep only one SPF record. The symptom is validation failure, the root cause is record drift, and the fix is to merge the sources into a single TXT value.
  • ptr still in the record. It burns lookup budget and adds complexity without giving the team much practical value. The fix is to remove it and replace it with explicit authorization.
  • Forgotten subdomains. Google says each subdomain needs its own SPF record when it sends mail. If a transactional tool uses a subdomain and that subdomain has no record, SPF fails even though the parent domain looks fine.
  • +all at the end. That one authorizes the entire internet. It is not security, it is an open door.
  • Chained include records from vendors. One include looks harmless until the vendor's record includes two more vendors and the lookup budget evaporates.
The sign of trouble often shows up in DMARC aggregate data as repeated SPF failures or permerror-like patterns tied to a specific sender path. That's the clue, not the destination. The fix is usually in the inventory, not in the mailbox provider.
The inbox-placement consequence is direct. Duplicate records, bloated include chains, and forgotten subdomains lower trust, and lower trust leads to harder filtering. Teams that keep treating SPF as a setup task instead of a maintained inventory always end up cleaning up the same mess later.

Maintaining SPF Records and Frequently Asked Questions

SPF is not a launch-and-forget setting. Review it on a schedule, audit new vendors, remove dormant includes, verify subdomain coverage for marketing, transactional, and outbound mail, and recalculate the lookup count after every change. If the sending footprint changes, the record has to change with it.
Ownership matters too. Someone has to compare DMARC reports with the live SPF inventory so the record reflects actual senders instead of stale assumptions. That matters for larger organizations with several teams, and it matters just as much for smaller companies that rely on rotating tools and outside agencies.
For larger stacks, MailAdept can centralize SPF review alongside broader deliverability work, while platforms such as manage email accounts in WebinOne can help keep sender identity organized across teams.
notion image

FAQ

How long does SPF take to propagate?It depends on the DNS provider's caching behavior, but the test is whether receivers can query the updated TXT record reliably.
Is SPF alone enough for Gmail and Yahoo?No. SPF is only one layer, and it needs DKIM and DMARC to support inbox placement and brand alignment.
What happens when a vendor needs a subdomain?That subdomain needs its own SPF record if it sends mail. The parent record does not cover it automatically.
Will changing SPF affect current campaigns?Yes, if the change removes or forgets a legitimate sender. Every edit needs a lookup-count check and a live test send.
SPF works when it matches the sending inventory, and it fails when the inventory drifts. MailAdept helps teams audit authentication, clean up record ownership, and keep SPF aligned with the mail sources that send. If the domain's inbox placement is slipping or the authentication stack feels fragile, visit Mailadept and get a deliverability review before the next campaign exposes the gap.

Get expert insights on why your emails go to spam and how to consistently reach the inbox.

Fix Your Email Deliverability Before It Costs You Revenue

Get a Free Deliverability Audit

Written by

Thami Benjelloun
Thami Benjelloun

CEO Mailwarm, email deliverability expert.