What Does SPF Verify That DKIM Cannot, and What Does DKIM Verify That SPF Cannot?
Quick Answer
SPF verifies whether an email was sent from an authorized server for the sender’s domain, while DKIM verifies that the message content and selected headers were digitally signed and remain unchanged. Together, SPF and DKIM provide stronger email authentication and help prevent spoofing.
Try Our Free SPF Checker
Instantly analyze any domain's SPF record - check syntax, count DNS lookups, and flag errors.
Check SPF Record →
SPF verifies the connecting IP and the SMTP envelope sender (MAIL FROM and/or HELO) is authorized to send for your domain”something DKIM cannot assess”while DKIM verifies the cryptographic integrity and domain identity of selected headers and the message body via a signature (d=) that SPF cannot protect or attest.
Context and background Sender Policy Framework (SPF) is a DNS-based authorization check tied to the SMTP transaction. When a server connects to deliver mail, the receiver tests whether that source IP is allowed to send for the domain that appears in the envelope MAIL FROM or in HELO/EHLO. DomainKeys Identified Mail (DKIM), by contrast, is a content-level authentication system: the sender signs chosen headers and the body; receivers fetch the public key from DNS at selector._domainkey.domain and verify that nothing was tampered with and that the signers domain (d=) is real.
Why does this distinction matter? Because attackers exploit different gaps. Without SPF, anyone can send from arbitrary IPs pretending to be your domain at the SMTP level. Without DKIM, intermediaries (forwarders, mailing lists) or malicious actors can alter message content after handoff without detection. Modern receivers typically evaluate both under DMARC, which requires alignment between the domain users see in From: and either the SPF-authenticated envelope domain or the DKIM d= domain, then applies your policy.
AutoSPF is purpose-built to make SPF airtight”and to keep it that way as your IPs and vendors change”while providing DKIM/DMARC-aware diagnostics so both mechanisms consistently pass and align. Across a 90-day AutoSPF benchmark (hypothetical but realistic) covering 28 mid-market domains and 1.8M messages, SPF permerrors dropped 92% after automated include consolidation and safe flattening, and DMARC pass rates improved from 88% to 96% when customers paired these SPF fixes with DKIM alignment tuning.
What each verifies”and why the other cannot
This section stands alone: SPF checks transport-layer authorization; DKIM checks message integrity and domain identity after transport.
- SPFs scope
- Verifies: the connecting IP is authorized for the envelope domain (RFC5321.MailFrom) or HELO/EHLO host.
- Mechanisms: DNS TXT record v=spf1 with ip4/ip6, include, a, mx, exists, and modifiers like redirect; pass/fail happens before content is trusted.
- Why DKIM cant: DKIM doesnt see the connecting IP or the SMTP envelope. It operates solely on message content and DNS keys.
- DKIMs scope
- Verifies: cryptographic signature over selected headers (h=) such as From, To, Subject, Date, Message-ID, and the body hash (bh=), bound to the signers domain in d=.
- Detects: in-transit tampering (e.g., altered Subject, injected links, modified body) and authenticates the signers domain independently of the path.
- Why SPF cant: SPF does not sign or remember content; after handoff, forwarding or modifications dont affect SPF results tied to the original SMTP session.
Comparison at a glance
- SPF uniquely verifies:
- Connecting IP authorization
- Envelope MAIL FROM/HELO identity
- DKIM uniquely verifies:
- Header/body integrity via signature
- Signer domain (d=) authenticity unaffected by forwarding
How AutoSPF helps: AutoSPF continuously validates that every service and IP authorized to send for your domains is explicitly represented in SPF within the 10-lookup budget, flags gaps that would cause SPF neutral/permerror, and surfaces DKIM/DMARC alignment results so you can defer to DKIM where forwarding will break SPF.

How the mechanisms are applied inside SMTP and the message
This section stands alone: SPF operates at connection time; DKIM operates after delivery.
SPF: part of the SMTP transaction (MAIL FROM and connecting IP)
- SPF checks the Return-Path (envelope MAIL FROM) and/or HELO/EHLO domain against the source IP.
- If the MAIL FROM is empty (bounces), receivers often evaluate SPF on the HELO/EHLO domain.
- Because SPF is transport-bound, it is evaluated per-hop; if a forwarder re-sends from a different IP without SRS (Sender Rewriting Scheme), SPF will often fail at the next hop.
AutoSPF tie-in: AutoSPF simulates receiver-side SPF evaluations from multiple vantage points, budgets DNS lookups across includes, and highlights when your forwarders or third parties require SRS or explicit includes.
DKIM: cryptographic binding of headers and body
- DKIM signs selected headers listed in h= (commonly: From, Date, Subject, To, MIME-Version, Message-ID) and computes a body hash bh= using simple/relaxed canonicalization.
- The signature d=domain and s=selector point to a DNS TXT record with the public key (p=).
- Receivers recompute the hashes; any in-transit tampering (e.g., footer injection, subject tag changes) breaks verification.
AutoSPF tie-in: While AutoSPF doesnt mint your DKIM keys, it analyzes Authentication-Results headers and DMARC aggregates to show which messages rely on DKIM vs SPF, when DKIM breaks due to footer injections, and which senders need selector updates.
Case example (hypothetical, realistic): A health-tech newsletter routed through a list server appending [List] to Subject and a legal footer. SPF passed at the original hop, then failed post-forward. DKIM initially failed because the list modified signed headers and body. After the sender switched DKIM to relaxed/relaxed and excluded Subject from h= (keeping From and Date), DKIM passed consistently; AutoSPF then recommended raising DKIMs role in DMARC (adkim=s) and maintained SPF includes for initial hops.
Deployment differences, DNS formats, and pitfalls to avoid
This section stands alone: Implementers must juggle SPFs 10-lookup limit and DKIMs selector/key requirements.
SPF record mechanics
- Format: TXT at the root (and/or subdomain) containing v=spf1 ¦ -all.
- Includes/redirect: include:vendor.example.com adds the vendors mechanisms; redirect=domain defers evaluation entirely to another domains SPF.
- 10-lookup limit: include, a, mx, exists, ptr each count; nested includes add up; exceeding 10 returns permerror.
- TTL advice: 1 hour (3600s) is practical for agility; emergency changes propagate faster than day-long TTLs.
Common SPF pitfalls
- Multiple SPF TXT records at the same label (receivers may treat it as permerror).
- Exceeding 10 lookups due to nested includes or using mx/a across many hosts.
- Using ptr or +all, which are discouraged and abused.
- Misusing redirect when includes are intended (redirect overwrites evaluation).
AutoSPF tie-in: AutoSPF auto-consolidates redundant mechanisms, deduplicates vendor nets, safely flattens volatile includes into cached ip4/ip6 with health checks, and enforces 10-lookup budgeting”preventing permerrors without sacrificing vendor agility.

DKIM record mechanics
- Format: TXT at selector._domainkey.example.com with k=rsa; p=base64key; t=y (optional testing).
- Selectors: human-readable and time-coded selectors like s2026q1 enable overlapping deployments for rotation.
- Key sizes: 2048-bit RSA recommended; 1024-bit is deprecated; ECDSA (ed25519) is emerging but not universally accepted by all receivers yet.
- TTL advice: 1“4 hours; rotate keys with dual-publish periods.
Common DKIM pitfalls
- Publishing the key with extra quotes/line breaks causing invalid base64.
- Oversized records without proper 255-byte chunking in DNS.
- Canonicalization mistakes (signing headers likely to be modified, or using simple/simple where intermediaries tweak whitespace).
- Using l= (body length limit), which is risky and can cause false passes on partially modified content.
AutoSPF tie-in: AutoSPFs DKIM checks flag missing/invalid selector DNS records, test verification from multiple receivers, and suggest safer canonicalization/header sets when your mail flows (e.g., mailing lists) are likely to alter messages.
When SPF fails but DKIM saves you”and vice versa
This section stands alone: Real-world flows frequently break one mechanism; plan for the other to carry DMARC.
- Forwarding without SRS
- SPF: often fails at the forwarders hop (source IP no longer authorized).
- DKIM: passes if unchanged; DMARC can still pass via DKIM alignment.
- AutoSPF: reports domains/ASNs where SPF fails after forward; recommends strengthening DKIM alignment for those streams.
- Mailing lists (subject tagging, footer insertion)
- DKIM: frequently fails due to body/header changes.
- SPF: may pass at original hop, then fail if re-sent; SRS-capable lists can preserve SPF, but many dont.
- AutoSPF: identifies list server patterns in Authentication-Results, suggests relaxed canonicalization and From: rewriting strategies (RFC 5322) to preserve DMARC.
- Third-party senders and bulk marketing
- SPF: fails if you forget to include vendor includes or exceed lookups.
- DKIM: passes if vendor signs with your domain (d=yourbrand.com) and selector is correct; fails if vendor signs with their domain and DMARC requires strict alignment.
- AutoSPF: onboards vendors via cataloged include endpoints, tracks vendor IP churn, and alerts when DKIM is signed with a non-aligned domain that will break DMARC.
- Transactional vs corporate relays
- Corporate relays sometimes rewrite Return-Path or HELO, affecting SPF, while DKIM from the original application survives if not re-wrapped.
- AutoSPF: simulates both envelope and header alignment to show which mechanism will satisfy DMARC per stream.
Original data point (hypothetical, aggregated): In an anonymized AutoSPF cohort of 40 domains, 27% of DMARC passes during forwarding relied solely on DKIM alignment; enabling SRS on forwarders in two EDU tenants reduced SPF failures on forwarded mail by 61% without harming DKIM.

DMARC alignment, policy, and joint best practices
This section stands alone: DMARC decides based on alignment with header From:.
- Alignment rules
- SPF: the domain in RFC5321.MailFrom (or HELO if MAIL FROM is empty) must align with header From: (organizationally”relaxed”or exactly”strict).
- DKIM: the d= domain in the DKIM signature must align with header From:.
- DMARC passes if either aligned SPF or aligned DKIM passes.
- Policy path
- Start with p=none; capture rua= aggregate reports; move to quarantine then reject as failure rates and false positives stabilize.
- Use adkim=s and aspf=s for high-impersonation brands; remain relaxed (r) during migrations to reduce breakage.
- Key and record hygiene
- DKIM: rotate 2048-bit keys every 6“12 months; maintain overlapping selectors; retire old keys promptly if compromised.
- SPF: stay within 10 DNS lookups, prefer include over flattening unless you have automated refresh, and avoid ip churn surprises.
AutoSPF tie-in: AutoSPF calculates per-sender alignment coverage, shows whether DMARC passes are coming from SPF or DKIM per source, recommends adkim/aspf modes per stream risk, and auto-maintains SPF so you can lean on DKIM where forwarding disrupts SPF.
Case study (hypothetical): Retailer AcmeFit onboarded 12 SaaS senders, producing 14 SPF lookups and frequent permerrors. AutoSPF consolidated includes, safely flattened two volatile vendors, and split marketing subdomain SPF into its own record; permerrors dropped to zero and Gmail inbox placement improved 4.8 percentage points over 30 days once DMARC was set to quarantine with DKIM relaxed alignment.
Failure modes, diagnostics, and tools
This section stands alone: Know how each fails and how to fix fast.
Common SPF failure causes
- Neutral/SoftFail from ~all when receivers weigh other signals negatively.
- Permerror from >10 DNS lookups, syntax errors, multiple SPF TXT records, or recursive redirect loops.
- None when there is no SPF record or an empty/invalid one.
How to diagnose
- Inspect Authentication-Results: spf=permerror (too many DNS lookups) smtp.mailfrom=¦
- Use dig/nslookup to expand include chains; count lookups.
- Validate with multiple checkers from different networks.
AutoSPF tie-in: AutoSPFs real-time evaluator expands your SPF exactly as a receiver would, shows the lookup budget, flags recursion, and proposes a one-click corrected record.
Common DKIM failure causes
- body hash mismatch from footer injection or whitespace changes with simple body canonicalization.
- header list mismatch when intermediaries add Subject tags or re-order headers not covered by relaxed.
- selector DNS errors: missing p= key, wrong label, TXT formatting/quoting issues.
- expired or revoked keys not updated in senders.
How to diagnose
- Authentication-Results: dkim=fail (body hash did not verify) header.d=example.com header.s=s2026q1
- Fetch selector DNS record; ensure valid base64 p= without stray quotes; verify 2048-bit.
- Test with synthetic sends through each hop; vary canonicalization.
AutoSPF tie-in: AutoSPF correlates DKIM failures with hop-by-hop Received chains, flags which MTA altered the message, and recommends resilient header sets (e.g., include From, Date, MIME-Version, Message-ID; avoid Subject where subject-tagging is expected).
Essential testing and monitoring tools
- Synthetic sends: to Gmail, Outlook, and a neutral verifier (e.g., check-auth@verifier.port25.com) to capture SPF/DKIM/DMARC results.
- DNS tools: dig/host/nslookup for SPF/DKIM TXT, and online SPF flattening simulators.
- DMARC reports: aggregate (rua) for volume-level patterns; forensic (ruf) for detailed failures (mind privacy/regulatory constraints).
AutoSPF tie-in: AutoSPF consumes rua XML, normalizes per-source pass/fail, highlights unusual spikes (e.g., sudden include changes), and provides a test-send harness that compares receiver interpretations.

Key lifecycle and change management
This section stands alone: Rotate DKIM keys deliberately; manage SPF as living infrastructure.
- DKIM lifecycle
- Use 2048-bit RSA; maintain two active selectors during rotation.
- Selector naming: sYYYYqN or vendor-purpose like s2026q1-marketing.
- Rotation cadence: 6“12 months; immediate revoke and re-key if compromised (set p= to blank or remove record and stop signing with that selector).
- SPF lifecycle
- Vendor churn: onboard/offboard includes promptly; never leave stale vendors authorized.
- Subdomain scoping: isolate high-volume streams (e.g., mail.m.example) with distinct SPF to keep lookup budgets manageable.
- Emergency changes: maintain lower TTLs and a change log.
AutoSPF tie-in: AutoSPF tracks vendor includes, warns when providers add/remove IP ranges, auto-updates flattened records on schedule, and exports an audit trail. It also inventories DKIM selectors observed in DMARC data so you know which keys to rotate.
ARC: addressing forwarding limitations
This section stands alone: ARC complements SPF/DKIM/DMARC in complex flows.
- What ARC does
- Authenticated Received Chain (ARC) lets intermediaries attest to the original SPF/DKIM/DMARC results and the path taken.
- Receivers can weigh ARC sets to trust that a message altered by a list or forwarder was good at ingress.
- When to use
- If you operate forwarding services, mailing lists, or campus/enterprise gateways that routinely break DKIM or SPF.
- ARC doesnt replace SPF/DKIM/DMARC; it supplies continuity across hops.
AutoSPF tie-in: AutoSPF highlights when DMARC failures could be mitigated by ARC (e.g., consistent dkim=fail at second hop with ARC-Seal present), helping operators prioritize ARC deployment on intermediaries that matter most.
FAQ
Should I use -all or ~all in SPF?
- -all (hard fail) signals strong policy and reduces spoofing, but can increase false rejects during migrations.
- ~all (soft fail) is safer during onboarding; combine with DMARC p=none/quarantine and move to -all as DMARC data stabilizes.
- AutoSPF recommends per-domain policy stages and alerts on legitimate sources that would be blocked by -all.
Do I need strict DMARC alignment (adkim=s, aspf=s)?
- Strict alignment thwarts cousin-domain impersonation but can break legitimate flows (e.g., vendor signs with their d=).
- Start relaxed, then move to strict for high-risk brands and streams once vendors sign with your domain.
- AutoSPFs alignment coverage report shows readiness per stream.
How often should I rotate DKIM keys and what size?
- Rotate every 6“12 months; use 2048-bit RSA today.
- Keep two selectors active during rotation to avoid interruptions.
- AutoSPF inventories selectors seen in traffic so your rotation list is complete.
Can I have multiple SPF records?
- No. A domain must publish a single SPF TXT record; multiple records can produce permerror.
- AutoSPF merges mechanisms into a single, standards-compliant record and validates syntax.
Why does SPF pass but DMARC still fail?
- Because the SPF-authenticated domain (MAIL FROM or HELO) doesnt align with the header From: domain.
- Ensure the envelope domain matches (or is in the same organizational domain) as the visible From:, or rely on DKIM with d= aligned.
- AutoSPF simulates DMARC alignment on top of SPF to catch this.
Conclusion and product integration
SPF and DKIM solve different halves of the email trust problem: SPF authorizes the sending IP and SMTP envelope domain, while DKIM proves the integrity and domain identity of the message itself; together under DMARC they block spoofing and detect tampering in the flows you actually run. The practical challenge is ongoing hygiene: keeping SPF within the 10-lookup limit as vendors change, ensuring DKIM survives real-world modifications, and aligning both with DMARC policy so receivers can trust what your users see.
AutoSPF operationalizes that hygiene. It:
- Builds and maintains a single, correct SPF record per domain, deduplicating mechanisms, budgeting lookups, and safely flattening volatile vendors with health checks.
- Monitors DMARC aggregates to show where DMARC passes derive from SPF vs DKIM, so you can optimize alignment and survive forwarding.
- Diagnoses failures fast by expanding include chains like a receiver, flagging permerrors, and correlating DKIM selector issues observed in the field.
- Guides policy hardening”moving from ~all to -all, from relaxed to strict alignment”based on data from your traffic, not guesswork.
If your next quarter includes onboarding a new marketing platform, consolidating ESPs, or tightening DMARC to reject, AutoSPF gives you the safety rails to do it confidently”so SPF verifies what DKIM cannot, DKIM verifies what SPF cannot, and DMARC enforces your brands trust end to end.
General Manager
Founder and General Manager of DuoCircle. Product strategy and commercial lead for AutoSPF's 2,000+ customer base.
LinkedIn Profile →