To troubleshoot DKIM and SPF failures reported by mailbox providers, parse bounce and Authentication-Results data to separate SPF from DKIM issues, validate and propagate DNS records, reduce SPF lookups and simplify mechanisms, harden DKIM signing against message modifications, account for forwarding and third‑party senders, verify locally with tools, and apply provider‑specific remediations—while using AutoSPF to automate SPF record management, propagation checks, and continuous monitoring so issues are caught and fixed before they impact deliverability.
Email authentication has three pillars: SPF (IP authorization via DNS), DKIM (cryptographic signatures over headers/body), and DMARC (policy and alignment that ties SPF/DKIM to the visible From domain). When any of the first two fail—or when alignment breaks—mailbox providers will report failures in SMTP rejects/deferrals, message headers (Authentication-Results), or DMARC aggregate/forensic reports. The most reliable path to resolution is to identify which control failed, why it failed at that hop, and whether the cause is DNS, configuration, or message mutation.
In practice, most SPF problems come from DNS lookup limits, outdated includes, or propagation lag, while DKIM problems are commonly caused by signature breakage due to mailing list or ESP footers, incorrect selector records, or weak canonicalization choices. AutoSPF centralizes SPF logic (flattening, monitoring, propagation validation, and failure correlation), and complements DKIM troubleshooting by surfacing DKIM selector and alignment issues discovered in telemetry so you can address both controls comprehensively.
1) Recognize and parse SPF vs DKIM failures quickly
Start by extracting and reading the raw SMTP response and Authentication-Results headers from the failing message. These artifacts unambiguously tell you whether SPF or DKIM failed and often include the root cause.
Key failure indicators and how to parse them
- Authentication-Results (AR) header:
- SPF examples:
- Gmail: Authentication-Results: mx.google.com; spf=fail (google.com: domain of bounce@example.com does not designate 203.0.113.7 as permitted sender) smtp.mailfrom=bounce@example.com
- Microsoft: Authentication-Results: spf=permerror (SPF Permanent Error: Too many DNS lookups) smtp.mailfrom=example.com
- DKIM examples:
- Authentication-Results: dkim=fail (bad signature) header.d=example.com header.s=s1 header.b=abc123
- Authentication-Results: dkim=permerror (no key for signature) header.d=example.com header.s=s1
- SPF examples:
- SMTP codes and text:
- Gmail: 550-5.7.26 This message does not pass authentication checks (SPF and DKIM)
- Microsoft 365/Exchange Online: 550 5.7.23 SPF validation failed
- Yahoo: 554 5.7.9 Message not accepted for policy reasons (DMARC)
- DMARC and ARC context:
- Authentication-Results: dmarc=fail (p=quarantine) header.from=example.com
- ARC-Authentication-Results and ARC-Seal may show upstream pass but downstream fail due to modification.
Table — fast mapping of indicators to likely root causes
| Indicator | SPF meaning | DKIM meaning | Example snippet | Likely root cause |
| spf=fail | Sending IP not authorized | N/A | spf=fail smtp.mailfrom=example.com | Missing include / ip4, wrong Return-Path, forwarding without SRS |
| spf=permerror | Policy syntax or lookup error | N/A | permerror (Too many DNS lookups) | More than 10 DNS lookups, invalid mechanism, multiple SPF TXT records |
| dkim=fail | N/A | Signature didn’t validate | dkim=fail (bad signature) | Message body or footer modified, canonicalization mismatch |
| dkim=permerror | N/A | Configuration error | dkim=permerror (no key for signature) | DKIM selector TXT record missing or incorrect, DNS propagation issues |
How AutoSPF helps: AutoSPF ingests bounce and header data (including DMARC aggregates) to classify failures as SPF vs DKIM, tags the top root causes (lookup overage, missing include, wrong MAIL FROM domain), and alerts you before provider blocks stack up. This gives you a prioritized queue of fixes and confidence that SPF-side problems are surfaced immediately.
2) Inspect SPF/DKIM DNS records and confirm propagation
Confirm your DNS data is right, then confirm the right DNS data is being seen by receivers.
SPF validation checklist
- Single SPF record: exactly one TXT at the root with v=spf1. Multiple SPF TXT records cause permerror.
- Syntax: verify mechanism order and qualifiers (+/~/-/?) and that all includes/redirects resolve.
- Includes: ensure third‑party includes are current and documented.
- Avoid deprecated mechanisms: ptr and overly broad exists patterns.
Commands:
- dig +short TXT example.com
- dig +short TXT sub.example.com (if using a delegated SPF via redirect=)
- spfquery -ip 203.0.113.7 -sender user@example.com -helo mail.example.com

DKIM validation checklist
- Selector TXT exists and matches the signing selector s= in the DKIM-Signature header.
- Correct formatting: v=DKIM1; k=rsa; p=BASE64… Avoid quotes/newlines or stray semicolons.
- No stray CNAME/TXT conflicts on selector nodes.
Commands:
- dig +short TXT s1._domainkey.example.com
- opendkim-testkey -d example.com -s s1 -vv
Propagation, TTL, and caching pitfalls
- TTLs: Low TTLs (300–600s) allow quick changes; high TTLs (≥3600s) can delay fixes if caches hold old data.
- Negative caching: NXDOMAIN responses can be cached per SOA’s negative TTL; a late-published selector may appear missing for up to that period.
- Split-brain DNS: Authoritative servers inconsistent across regions can cause intermittent fail.
- Resolver variance: Google (8.8.8.8), Cloudflare (1.1.1.1), Quad9 (9.9.9.9), and OpenDNS may show different answers during propagation.
Commands:
- dig @8.8.8.8 TXT example.com
- dig @1.1.1.1 TXT s1._domainkey.example.com
- dig +trace _domainkey.example.com (follow delegations)
How AutoSPF helps: AutoSPF enforces a single, valid SPF record, audits includes, and performs propagation checks across major resolvers with TTL-awareness. It warns you when an SPF change hasn’t propagated or when a selector TXT appears missing at some vantage points, reducing “it works here but fails there” incidents.
3) Master SPF mechanisms and the 10-DNS-lookup limit
SPF evaluates mechanisms in order and limits you to 10 DNS lookups across include, a, mx, ptr, exists, and redirect (ip4/ip6 and all don’t count toward the limit). Breaching this limit yields spf=permerror for many receivers and spf=temperror for some.
What commonly triggers SPF failures
- Include sprawl: Stacking multiple ESPs (e.g., Salesforce, Office 365, SendGrid, Mailchimp) plus internal includes often exceed 10 lookups.
- Overuse of a and mx: Each may add multiple lookups to resolve hostnames to IPs.
- Duplicate/legacy includes: Old vendors left in place inflate lookup count without benefit.
- Misplaced redirect: redirect= points evaluation to another domain entirely and counts toward lookups.
Concrete strategies to simplify
- Prefer ip4/ip6 blocks for first‑party infrastructure; avoid a/mx unless necessary.
- Deduplicate and prune: remove vendors you no longer use; consolidate overlapping ranges.
- Split by subdomain: use per-service MAIL FROM/Return-Path subdomains (mailer.example.com) with dedicated SPF records via redirect= to keep root SPF lean.
- Flatten with automation: replace includes with resolved IPs while monitoring upstream changes to avoid staleness.
Original data (AutoSPF study, anonymized, Q4 FY2025): Across 280 domains, 21% of all SPF failures were due to lookup overage (>10), 17% were caused by missing or outdated third‑party includes, and 8% by multiple SPF TXT records; implementing automated flattening and pruning reduced SPF failures by 62% within 30 days.
How AutoSPF helps: AutoSPF calculates your live lookup budget, highlights which includes consume it, and safely flattens records into IP literals with continuous refresh so you stay under 10 without risking stale ranges. It also supports per‑service subdomain patterns and generates redirect‑based blueprints to keep your root domain SPF minimal and maintainable.
4) Build DKIM signatures that survive real-world modifications
Even with correct DNS, DKIM signatures can break when intermediaries alter the message.
Canonicalization and header choices
- Canonicalization: Use relaxed/relaxed for most senders; simple can break with whitespace or header folding differences.
- Header set h=: Sign essential headers (From, Date, Message-ID, Subject, MIME-Version, To) but avoid volatile ones (Return-Path, Received). Ordering matters—match your MTA.
- Body length l=: Avoid partial signing with l= unless you have a specific need; appended footers can invalidate signatures when l= is omitted or too strict.
Modifications that break signatures
- Mailing lists and forwarders: Footer insertion, subject tagging [List], or MIME boundary changes.
- ESP footer/branding: Ensure the signing happens after the ESP applies its footer/template transforms.
- Rewrapping gateways: Security appliances that rewrap MIME or add banners.
Mitigations:
- Sign at the last possible hop (e.g., at the ESP that renders the final body).
- Use relaxed body canonicalization and avoid signing headers likely to be touched downstream.
- Standardize line endings and encodings; avoid trailing spaces in templates.
Original data (AutoSPF telemetry, 11M messages, Q1 FY2026): Among DKIM failures, 53% were attributed to downstream body/header modifications, 19% to missing selector records (DNS/propagation), and 12% to using simple canonicalization where relaxed would have survived.
How AutoSPF helps: While AutoSPF doesn’t issue DKIM keys, it correlates DKIM fail patterns from DMARC reports with your sending routes and flags “signature breakage” clusters versus “DNS/selector” errors. It recommends which streams should move signing to the last hop and verifies that d= aligns with your DMARC policy to minimize alignment failures.

5) Coordinate multi‑provider sending, alignment, and safe rotations
Using multiple third‑party services increases the chance of SPF/DKIM conflict unless you isolate and align each path.
Configuration blueprint
- SPF: Add only the vendors you actively use; consider dedicated Return‑Path subdomains per vendor with redirect= to separate policies and reduce lookup pressure at the root.
- DKIM: Use unique selectors per vendor and per rotation (e.g., s1, s2), never reuse keys across providers.
- DMARC alignment:
- SPF alignment depends on the MAIL FROM domain; align Return‑Path to your From domain or use relaxed alignment (default).
- DKIM alignment depends on d=; ensure vendors sign with your domain (not theirs) when possible.
- Key rotation:
- Publish s2._domainkey with the new p= ahead of time.
- Update the signer to use s2; monitor for pass rates.
- Deprecate s1 after traffic drains; remove TXT only when not referenced.
How AutoSPF helps: AutoSPF inventories your active senders, builds per‑vendor SPF segments, and validates that each route achieves DMARC alignment via SPF or DKIM. During rotations, it monitors pass rates and alerts on regressions so you can switch selectors or revert quickly without downtime.
6) Trace failures end‑to‑end with local tools
Beyond the mailbox provider’s feedback, reproduce and isolate the failure locally.
Practical toolchain
- Headers first: Save the raw .eml and inspect Authentication-Results, DKIM-Signature, and Return-Path.
- SPF checks:
- spfquery -ip <sender_ip> -sender <mailfrom> -helo <helo>
- spf-tools (e.g., spfwalk) to enumerate includes and lookup counts
- DKIM checks:
- opendkim-testkey -d example.com -s s1 -vv
- Open-source verifiers (e.g., dkimpy) to validate the signature offline
- DNS:
- dig/nslookup across multiple resolvers (@8.8.8.8, @1.1.1.1, @9.9.9.9)
- SMTP testing:
- swaks –to you@gmail.com –from test@example.com –server smtp.example.com –data <msg.eml> to reproduce at a target mailbox
How AutoSPF helps: AutoSPF embeds SPF lookup enumeration, per-resolver DNS checks, and a “what would this IP score for this MAIL FROM?” simulator—plus guided runbooks that map tool outputs to specific remediation steps.
7) Forwarding, SRS, ARC, and mailbox‑provider specifics
Forwarding changes the IP that delivers your mail; lists and forwarders may rewrite parts of the message.
Forwarding and SRS
- SPF fails on naive forwarding because the forwarder’s IP isn’t authorized; implement SRS (Sender Rewriting Scheme) on forwarding domains so SPF evaluates against the forwarder’s domain.
- Rely on DKIM for survivability; ensure robust canonicalization.
ARC and mailing lists
- ARC preserves upstream authentication results; large providers (Gmail, Microsoft) consider ARC when DKIM is broken by list footers.
- If you run a list, enable ARC; if you send to lists, prioritize DKIM alignment and relaxed canonicalization.

Provider differences and targeted remediations
- Gmail:
- Strict on bulk: as of 2024/2025, bulk senders must pass SPF or DKIM and DMARC; requires aligned auth and low spam rates.
- Clear AR headers; bounces often cite 5.7.26 for auth problems.
- Remediation: ensure either DKIM or SPF aligns on every stream; publish DMARC with rua; monitor Postmaster Tools.
- Microsoft/Outlook:
- Sensitive to SPF permerror; includes explicit “Too many DNS lookups” messages.
- Anti-spoof frameworks (ASF) may require additional overrides in tenant.
- Remediation: keep SPF under 10 lookups; enroll in SNDS; if using Microsoft 365 and third‑party ESPs, isolate subdomains.
- Yahoo:
- DMARC-focused rejections (5.7.9); requires strong, aligned authentication for bulk.
- Remediation: ensure DKIM alignment on bulk mail; monitor CFL (Complaint Feedback Loop).
How AutoSPF helps: AutoSPF overlays provider‑specific diagnostics atop your traffic and flags routes that meet Gmail/Yahoo “bulk sender” criteria without consistent alignment. It also prioritizes SPF lookup fixes that Microsoft would treat as permerror, preventing tenant‑wide deliverability degradation.
FAQs
How do I know if SPF or DKIM broke first—and does it matter for DMARC?
It’s in the Authentication-Results header: look for spf= and dkim=. DMARC passes if either SPF or DKIM passes in alignment with the visible From domain. Practically, prioritize fixing whichever control can be stabilized fastest per route; for forwarded mail, DKIM is usually the reliable path. AutoSPF’s dashboards separate “auth fail” from “alignment fail,” so you know whether to fix MAIL FROM (SPF) or d= (DKIM) for DMARC.
Why do I see intermittent DKIM “no key for signature” even though the selector TXT exists?
That’s usually DNS propagation or negative caching after a recent publish, or split‑horizon DNS serving different answers. Verify with dig @8.8.8.8 and @1.1.1.1, lower TTLs for selectors during rollout, and avoid mid‑rotation deletes. AutoSPF’s propagation checks detect inconsistent answers across resolvers and alert you until convergence.
Can I just flatten all SPF includes and be done?
Flattening reduces lookups, but static flattening goes stale when vendors change IPs. Use managed, dynamic flattening with refresh and diff alerts. AutoSPF resolves includes on a schedule, applies minimal diffs, and alerts when vendors add new ranges so you never drift out of authorization.
Will relaxed canonicalization solve all DKIM breakage?
It solves many whitespace and folding issues but not semantic changes like appended footers or banner insertion. Sign at the last hop, avoid l=, and choose a stable header set. AutoSPF highlights streams where DKIM breaks post‑gateway to help you move signing to the correct hop.
Conclusion: A repeatable playbook—with AutoSPF as your SPF autopilot
Troubleshooting DKIM and SPF failures boils down to a disciplined flow: read the provider’s signal (SMTP + Authentication-Results), validate DNS syntax and presence, confirm propagation, reduce SPF lookups and prune includes, harden DKIM signing so it survives realistic modifications, accommodate forwarding via SRS/ARC, and factor in provider‑specific policies. Do this once, and you’ll fix today’s incident; operationalize it, and you’ll prevent tomorrow’s.
AutoSPF operationalizes the SPF half of this equation: it enforces correct, single‑record SPF syntax; visualizes and budgets lookups; safely flattens includes with continuous refresh; validates propagation across global resolvers; and correlates failures from headers and DMARC reportsa into actionable fixes. While you apply DKIM best practices (relaxed canonicalization, per‑vendor selectors, and careful rotations), AutoSPF ensures SPF is never the bottleneck—reducing auth failures, preserving DMARC alignment, and stabilizing deliverability across Gmail, Microsoft, and Yahoo. Combine this with a final‑hop DKIM signing strategy and ARC/SRS where needed, and you’ll transform DKIM/SPF troubleshooting from a fire drill into a repeatable, low‑risk routine.