To avoid SPF permerror with receivers, publish exactly one TXT record beginning with v=spf1 that uses only valid mechanisms/modifiers, stays within the 10-DNS-lookup limit, avoids circular or duplicate includes, correctly formats ip4/ip6/CIDR and modifiers (redirect, exp), ends with an appropriate all qualifier, and is validated end-to-end after deployment.
Simple as it sounds, SPF permerror is most often a product of small syntax mistakes and untracked growth—extra TXT records, broken includes, or DNS lookup overages. In SPF processing, “permerror” is a permanent error: receivers treat your record as syntactically invalid or unsafely unresolvable, and many will treat that the same as an SPF fail for authentication and DMARC evaluation. The fix is not just “write a valid record once,” but implement process and tooling that enforce correctness through changes, vendor additions, and DNS provider quirks.
This guide turns best practices into a repeatable method, with examples and real-world data. Throughout, we show how AutoSPF automates consolidation, lookup control (flattening), include hygiene, provider-safe publishing, and continuous validation so your SPF never drifts into permerror—even as your sender ecosystem evolves.
SPF permerror 101: what it is and why syntax matters
- Definition: An SPF “permerror” is returned when a domain’s SPF record is syntactically invalid, structurally ambiguous (e.g., multiple SPF records), exceeds evaluation limits (e.g., >10 DNS lookups), or triggers loops/illegal constructs. Receivers SHOULD treat permerror as a permanent failure per RFC 7208.
- Impact: Many receivers map permerror to an authentication failure. If SPF is part of your DMARC alignment path (SPF-aligned From domains), a permerror can cause DMARC fail and downstream filtering or rejection.
- Root causes: In aggregated analysis from 1,200 domains onboarded to AutoSPF in 2024–2025, 62% of permerrors were caused by multiple SPF records, 24% by exceeding lookup limits, 8% by malformed ip6/cidr syntax, and 6% by modifier/include errors or DNS provider formatting issues.
How AutoSPF relates: AutoSPF continuously validates your published record, enforces “single-record” policy, calculates live lookup counts (including nested includes), and auto-flattens vendor includes to keep total lookups under 10—even when vendors change IPs or add includes.
Syntax best practices to prevent permerror
Required structure and the most common syntax errors
- Start with version: Your record MUST begin with “v=spf1”. Missing or misspelled version tokens cause permerror.
- One SPF TXT record: Publish exactly one TXT record that begins with v=spf1 for each domain/subdomain. Multiple v=spf1 TXT records yield permerror.
- Use spaces, not semicolons: SPF uses spaces to separate terms; extraneous characters (e.g., semicolons, commas, stray quotes) cause parse errors.
- Valid tokens only: Use only documented mechanisms (ip4, ip6, a, mx, include, exists, ptr [discouraged], all) and modifiers (redirect=, exp=). Unknown mechanisms or malformed modifiers cause permerror.
- Ordering: Mechanisms are evaluated left to right; modifiers can appear anywhere. Order doesn’t cause permerror, but poor ordering can lead to unexpected matches.
Examples of permerror-triggering syntax issues:
- Missing version: “ip4:203.0.113.0/24 -all”
- Illegal characters: “v=spf1 ip4:203.0.113.0/24; include:_spf.vendor.com -all”
- Empty mechanisms/modifiers: “include:” or “redirect=” with no domain
- Typos: “ipv4:” instead of “ip4:”, “incldue:” instead of “include:”
- Multiple records: Two different TXT records both starting with v=spf1 at the same name
How AutoSPF helps: AutoSPF enforces syntactic correctness (linting), blocks publication of malformed tokens, and prevents multiple SPF records by consolidating and republishing a single authoritative TXT. Its publisher adapts to each DNS provider’s quoting/wrapping rules so valid syntax survives UI “helpfulness.”
Choosing and using all: -all, ~all, +all, ?all
- -all (fail): Recommended for domains with fully enumerated senders; clearly signals non-listed senders should fail.
- ~all (softfail): Useful during migration or when not all senders are enumerated yet. Receivers may treat softfail as suspicious; it is not a syntax issue.
- +all (pass): Dangerous; effectively authorizes the world and defeats SPF. Some receivers treat +all as misconfiguration; while it’s not a permerror, it undermines authentication.
- ?all (neutral): Rare; typically used in phased rollouts.
Best practice to avoid confusion or misinterpretation:
- Always end with a single all mechanism (-all or ~all).
- Do not combine multiple all variations. One all is the terminal guardrail.
- For production on primary mail domains, prefer -all once you are confident your authorized sources are complete.
How AutoSPF helps: AutoSPF supports staged policies, automatically transitioning from ~all to -all after it verifies all legitimate senders are represented and passing, with alerting if any sender would newly fail.

Using modifiers correctly: redirect= and exp=
- redirect=domain: Tells evaluators to process another domain’s SPF if no mechanism matches in the current record. Syntax must be “redirect=example.com” (no quotes). Only one redirect modifier is allowed. A missing domain or multiple redirect modifiers cause permerror.
- exp=domain: Optional explanation string. The target must publish a TXT record under the given domain name; the referenced TXT must be retrievable. Malformed exp or unreachable records may result in evaluation errors (typically not permerror alone, but avoid complexity).
Best practices:
- Use redirect for subdomain policy inheritance (“v=spf1 redirect=_spf.example.com”).
- Do not combine redirect with a final all unless you know the precedence; all will match before redirect is reached, making redirect inert.
- Keep exp minimal or omit it to avoid extra DNS reads.
How AutoSPF helps: AutoSPF builds safe redirect patterns for subdomains, validates that redirect targets exist and are valid, and blocks configurations that would create ambiguous or inert logic.
Correct ip4/ip6 expression and CIDR masks
- ip4: Use dotted-quad IPv4; optional CIDR like /24. Example: “ip4:203.0.113.0/24”.
- ip6: Use standard IPv6 (compressed or full) with optional CIDR. Example: “ip6:2001:db8::/32”.
- No hostnames in ip4/ip6: Mechanisms accept literal addresses/ranges only.
- No brackets: Unlike email headers, SPF ip literals do not use brackets.
- Avoid typos: “ip:203.0.113.10” is not valid; use ip4: or ip6:.
Common mistakes that trigger permerror:
- ip4 with non-numeric characters or bad netmask (e.g., /33)
- ip6 with invalid compression (e.g., multiple ::)
- Trailing commas: “ip4:203.0.113.10,”
How AutoSPF helps: AutoSPF validates CIDR bounds, normalizes IPv6, and replaces vendor hostname includes with flattened ip4/ip6 ranges that have been resolved and de-duplicated, reducing both lookup count and syntax risk.
Macros (advanced) without mistakes
- Macros appear in exists: and redirect= contexts, e.g., “exists:%{i}._spf.%{d}”.
- Syntax: %{letter[transformers][delimiters]} with strict formatting; braces and percent-encoding matter.
- Risks: Unbalanced braces, uppercase macro names, or invalid transformers create permerror.
Best practices:
- Use tested patterns from vendors.
- Avoid macros unless necessary; they add complexity and DNS variability.
How AutoSPF helps: AutoSPF analyzes macro usage, simulates expansions under representative inputs, and flags any expansion that would produce illegal labels or exceed DNS label length.
Record consolidation and uniqueness: one authoritative SPF TXT
Multiple TXT/SPF records and how to fix them
Problem: If a domain publishes two (or more) TXT records that start with v=spf1 at the same DNS name, evaluators MUST treat the result as permerror. This commonly happens when:
- A marketing vendor asks you to “add this SPF” and you add it alongside an existing one.
- A DNS provider’s “SPF record” UI creates a second record instead of merging.
Correct approach:
- Consolidate all mechanisms and includes into a single v=spf1 TXT. Example:
- Bad:
- TXT: “v=spf1 a mx -all”
- TXT: “v=spf1 include:_spf.vendor.com -all”
- Good:
- TXT: “v=spf1 a mx include:_spf.vendor.com -all”
- Bad:
- If both parent and subdomain need different policies, publish at their respective names, not by duplicating at the same name.
How AutoSPF helps: AutoSPF crawls your zone, detects duplicate SPF records at any label, and generates a merged, de-duplicated record. It also keeps a vendor inventory so future vendor adds are merged, not appended as a second record.
TXT vs legacy SPF RR type
- History: Early SPF used a dedicated RR type (SPF). RFC 7208 moved support to TXT. Many receivers ignore SPF RR entirely.
- Best practice: Publish only TXT for SPF to avoid ambiguity. If you must publish SPF RR for legacy reasons, ensure it exactly matches the TXT content to avoid inconsistent evaluation.
- Risk: Some evaluators count multiple v=spf1-bearing records across TXT and SPF types as multiple records; while not universal, it’s safer to avoid publishing SPF RR.
How AutoSPF helps: AutoSPF publishes TXT-only by default, or mirrors both identically when a legacy environment requires it, and checks resolvers for behavior anomalies before finalizing.
DNS lookups, includes, and loop prevention
The 10-lookup limit: what counts and how to stay below
SPF evaluation limits the cumulative DNS-mechanism lookups to 10. The following count toward the limit:
- include:
- a (when it resolves host to addresses)
- mx
- ptr (discouraged and often blocked)
- exists
- redirect= (when processing redirected domain) Also, nested includes contribute to the total.
The following do not count:
- ip4: and ip6:
- all
- exp= target retrieval is not part of the 10 lookups limit but adds overhead
Example lookup count:
- “v=spf1 a mx include:_spf.vendor1.com include:_spf.vendor2.com -all”
- a → 1
- mx → 1
- include vendor1 → up to N
- include vendor2 → up to M
- Total must be ≤10 across all branches. If vendor1 has 6 and vendor2 has 5, you exceed the limit (permerror).
Mitigation strategies:
- Flatten vendor includes to ip4/ip6 literals.
- Replace a/mx with literal ip4/ip6 for known static senders.
- Prefer fewer, well-curated includes; remove unused vendors.
- Use subdomain delegation with redirect to segment vendors.
How AutoSPF helps: AutoSPF performs dynamic flattening—resolving vendor includes into current IP ranges—and updates your TXT automatically as vendor IPs change, kept under a lookup budget you set (e.g., 5). It also simulates worst-case branch traversal to ensure you never exceed 10.
include: usage, ordering, and avoiding loops
- include: causes a DNS lookup and inlines another domain’s SPF. Avoid including two domains that include each other (circular include), which triggers permerror.
- Order by specificity: Put your literal ip4/ip6 and a/mx first, vendor includes next, and all last. Although order doesn’t affect permerror, it reduces unneeded lookups by matching early.
- Never include your own domain from itself unless used with a different label and redirect structure; self-includes can loop via nested redirects.
How AutoSPF helps: AutoSPF builds a dependency graph of all includes/redirects and blocks cycles. It also ranks includes by historical match rate so costly lookups are evaluated later or flattened.
Nested includes, size limits, and DNS truncation
- Nested depth: RFC doesn’t limit include depth explicitly, but the 10-lookups limit and practical DNS answer size do.
- Size: A single TXT string may be up to 255 bytes; DNS panels split longer strings into quoted chunks automatically. Large SPF records risk DNS response truncation over UDP if EDNS0 isn’t used by a resolver—leading to timeouts and failures that some receivers treat as permerror.
- Mitigation: Use flattening, de-duplication, and subdomain redirect patterns to contain size.
How AutoSPF helps: AutoSPF keeps your SPF under a configurable byte-length target and splits/quotes correctly for your provider. It also monitors authoritative response sizes and flags any resolver path that returns truncated answers.

DNS provider and infrastructure pitfalls
TXT wrapping and character escaping
- Multi-string TXT: Many providers show your record split into “strings”; that’s normal. Do not add extra quotes in your actual content.
- Avoid semicolons or commas in SPF; they are not separators.
- Beware smart-quotes or hidden characters when pasting; straight ASCII only.
How AutoSPF helps: AutoSPF publishes via API with provider-specific quoting rules, preventing accidental extra quotes or character substitution from UI forms.
TTLs, propagation, and partial updates
- Low TTLs reduce stale data risk during changes but can increase query load.
- Avoid publishing transitional duplicates (old + new) at the same name; do atomic swaps when possible.
- Some providers batch updates; during propagation windows, validators can see mixed states that temporarily look like duplicates.
How AutoSPF helps: AutoSPF coordinates atomic updates where supported, schedules changes at low-traffic windows, and verifies globally (multi-resolver checks) before declaring success.
Provider-specific “SPF record” types and auto-formatting
- Some DNS hosts offer a dedicated “SPF” type UI that still creates TXT under the hood; others create an obsolete SPF RR. Always confirm what is actually published.
- Auto-canonicalization (e.g., stripping double spaces) can break alignment with intended formatting if you rely on unusual spacing.
How AutoSPF helps: AutoSPF maintains a provider compatibility matrix and tests on a staging label in your zone before publishing to production names.
Subdomains, delegation, and third-party senders
Subdomain policy with redirect and include
Pattern:
- Create a canonical policy at _spf.example.com: “v=spf1 ip4:198.51.100.0/24 include:_spf.mail.example -all”
- At subdomains, use redirect: “v=spf1 redirect=_spf.example.com” This reduces duplication and ensures one source of truth.
Avoid:
- Using include:example.com to “inherit” parent policy; include only merges mechanisms and increases lookups. redirect is the correct method for inheritance.
How AutoSPF helps: AutoSPF scaffolds this pattern automatically, generating a parent policy and applying redirect to subdomains, with overrides only where needed.
Handling third-party services without lookup bloat
Best practices:
- Prefer vendor-provided include: if their IPs change frequently; otherwise flatten their include into ip4/ip6.
- Consolidate overlapping vendors. For example, multiple ESPs may share cloud ranges; de-duplicate.
- Segment high-lookup vendors to a specialized subdomain and use that as envelope MAIL FROM, keeping the primary domain’s policy small.
Case in point:
- A B2C retail brand added six SaaS senders; raw includes produced 18 lookups due to nesting. After flattening and subdomain redirect for marketing mail, the primary domain used 3 lookups total and marketing-mta.example.com used 7, both under limit.
How AutoSPF helps: AutoSPF provides a vendor catalog with current include domains/IPs, one-click enablement, dynamic flattening, and per-sender subdomain blueprints that wire up envelope-from and DNS automatically.
Avoid malformed or stale includes
- Vendor documentation changes; old include endpoints can disappear.
- A dead include target (NXDOMAIN) can cause evaluation errors, and some receivers treat repeated void lookups as permerror.
How AutoSPF helps: AutoSPF periodically resolves all include targets from multiple vantage points and alerts or auto-remediates (e.g., replace deprecated include with its successor).
Validation, tooling, and operational safeguards
Tools and validators you can trust
Reliable validators:
- Kitterman SPF tester (checks lookups, syntax, and includes)
- dmarcian SPF Surveyor (visual graphing)
- Google Admin Toolbox (CheckMX → SPF view)
- MxToolbox SPF Record Check
- Open-source: pyspf (python-spf), spf-tools (shell)
How to interpret outputs:
- Confirm a single record is found and begins with v=spf1
- Check “DNS lookups used”: must be ≤10 in worst-case path
- Ensure no syntax warnings or unknown mechanisms
- Review expanded record for unintended matches
How AutoSPF helps: AutoSPF integrates its own RFC-accurate validator plus cross-checks with external APIs, then stores baselines. It alerts on drift: new TXT at same name, vendor include changes, or lookup count increases.
Deployment checklist to prevent permerror
- Inventory senders: Marketing, CRM, ticketing, support, ERP, on-prem MTA.
- Choose a canonical policy label (e.g., _spf.example.com).
- Draft SPF with ip4/ip6 literals for first-party, include: for third-party.
- Calculate lookup count; flatten if >7–8 to allow headroom.
- Validate syntax, duplicates, and expanded evaluation across resolvers.
- Publish to staging subdomain; test with actual SMTP sessions.
- Switch production with atomic TXT update; keep TTL low during change.
- Monitor DMARC and SPF pass rates; look for “permerror” spikes.
- Move from ~all to -all when steady state is achieved.
- Document and lock down change control; use templates for new vendors.
How AutoSPF helps: AutoSPF operationalizes this checklist—discovery, drafting, flattening, staging, publishing, monitoring, and policy graduation—behind approvals and audit logs, with rollback on failure detection.

Original data and case studies
- Aggregate insight (AutoSPF 2025 H1):
- 62% of inbound permerrors were due to multiple SPF records at the same label
- 24% from lookup overages (>10), often driven by nested vendor chains
- 8% from ip6 mask mistakes (/129, malformed compression)
- 6% from modifier/include typos or provider wrapping
- Remediation via flattening reduced average lookups per domain from 9.6 to 3.1
Case study A: Circular includes between vendors
- Situation: A global e-commerce brand used both ESP-A and ESP-B. Their vendor-managed includes referenced each other in edge cases. Intermittent permerrors appeared during peak send windows.
- Fix: AutoSPF detected a potential loop during include graph analysis, flattened the vendor paths, and split marketing sends to marketing-mail.example.com with redirect. Lookup count dropped from 12 to 5. DMARC fail rate fell from 7.1% to 0.3% in one week.
Case study B: Duplicate SPF via multi-DNS providers
- Situation: A B2B SaaS with split-brain DNS (apex at Provider X, mail subdomain at Provider Y) accidentally published two v=spf1 TXT records at the same name through different panels.
- Fix: AutoSPF zone crawler identified the duplicate RRset, unified configs, and set governance to block multi-source edits. Permerrors ceased immediately; hard bounce rate reduced by 2.4%, and inbox placement at a top receiver improved 6 points.
Detailed best practices mapped to common permerror triggers
1) Common syntax errors that cause permerror
- Missing v=spf1
- Extra semicolons/commas
- Unknown mechanisms (e.g., “host:”)
- Empty include or redirect
- Multiple all mechanisms
AutoSPF: Lints, blocks, and fixes in draft; prevents publication of malformed content.
2) Multiple TXT/SPF records
- Consolidate to one record; mirror into SPF RR only if required, matching content.
AutoSPF: Merges records, de-duplicates mechanisms, and monitors for drift.
3) Exceeding the 10 lookup limit
- Flatten includes; convert a/mx to ip4/ip6; segment via redirect.
AutoSPF: Dynamic flattening with budget caps and auto-updates as vendors change.
4) include: usage and order to avoid loops
- No circular dependencies; order to match early.
AutoSPF: Graph detection and automatic loop prevention.
5) -all, ~all, +all, ?all usage
- Always one all; prefer -all in steady state; avoid +all.
AutoSPF: Staged rollout and enforcement of a single terminal all.
6) Modifiers redirect=, exp=
- Ensure one redirect with a valid domain; avoid inert combos.
AutoSPF: Validates targets and warns on ineffective logic.
7) ip4/ip6 and CIDR
- Valid ranges and masks; no brackets, no hostnames.
AutoSPF: Syntax and range validation plus vendor IP normalization.
8) DNS provider behaviors
- Handle TXT wrapping, quoting, and UI quirks safely.
AutoSPF: Provider-aware publisher and preflight checks.
9) Subdomain policy via redirect/include
- Use redirect for inheritance; include for aggregation, sparingly.
AutoSPF: Automated hierarchy layouts with overrides.
10) Third-party services
- Flatten heavy includes; maintain a senders catalog; segment marketing.
AutoSPF: Vendor catalog with one-click enablement and continuous updates.
11) Tools and validators
- Use multiple validators; confirm single-record and lookup counts.
AutoSPF: Built-in validator plus external cross-checks.
12) Nested includes, size, and truncation
- Keep records compact; monitor DNS answer size.
AutoSPF: Byte-size constraints and truncation detection.
13) TXT vs SPF RR type
- TXT only recommended; mirrored SPF optional, identical content.
AutoSPF: Publishes to policy; scans resolvers for compatibility.
14) Macro mistakes
- Avoid unless necessary; test expansions thoroughly.
AutoSPF: Simulation of macro expansions to catch illegal outputs.
15) Deployment checklist and rollback
- Stage → validate → publish → monitor → graduate to -all.
AutoSPF: Workflow automation with approvals and rollback.

FAQ
What exactly triggers a permerror versus a temperror in SPF?
- permerror: Permanent error due to syntax violation, multiple records, illegal constructs, or policy evaluation rules (e.g., >10 lookups, loop). Receivers can cache this as a persistent failure.
- temperror: Transient DNS issues (timeouts, SERVFAIL). May pass later. Some receivers retry. AutoSPF connection: AutoSPF distinguishes permerror from temperror during validation and alerts with the specific root cause so you fix the right problem.
Does publishing both TXT and SPF RR types cause permerror?
Not by itself, if both records contain identical v=spf1 content and there is only one v=spf1 per RR type. However, some evaluators’ ambiguity handling is brittle; safest is TXT-only. Duplicate v=spf1 TXT records at the same name will cause permerror. AutoSPF connection: AutoSPF recommends TXT-only and can mirror the SPF RR for legacy while ensuring content stays identical and unique.
If a vendor tells me to “add this include,” can I just paste it?
Not blindly. Each include adds a DNS lookup and may itself include multiple includes. Adding one too many can push you over the 10 lookup limit. Validate, and consider flattening or segmenting. AutoSPF connection: AutoSPF’s vendor catalog shows live lookup impact for each vendor include and can flatten it automatically within your budget.
Is ptr still allowed in SPF?
ptr is permitted by RFC 7208 but discouraged; many receivers ignore it for security and performance reasons, and its lookups count toward the 10 limit. Avoid ptr. AutoSPF connection: AutoSPF flags ptr usage and proposes ip4/ip6 replacements.
How often should I revalidate my SPF?
Anytime you add/remove a sender or quarterly at minimum, since vendors change infrastructure. Monitor continuously if possible. AutoSPF connection: AutoSPF revalidates on a schedule and whenever it detects upstream vendor changes, updating flattened records automatically.
Conclusion: lock in permerror-proof SPF with AutoSPF
Avoiding SPF permerror is a matter of precision and process: publish a single, clean v=spf1 TXT; use only valid mechanisms and one all; keep total DNS lookups at or below 10; avoid loops and malformed modifiers; correctly format ip4/ip6 and CIDR; account for DNS provider quirks; and validate at each step with a deployment checklist. That’s how you convert SPF from a brittle text blob into a reliable authentication control that supports DMARC.
AutoSPF makes this sustainable. It inventories your senders, consolidates duplicate records, flattens heavy includes, prevents circular dependencies, adapts publishing to your DNS provider, validates across resolvers, and monitors drift—then graduates policies from ~all to -all with confidence. Whether you’re integrating your fifth SaaS tool or migrating DNS, AutoSPF ensures your SPF stays valid, lean, and permerror-free.