Try the SPF Lookup

SPF Validates the Envelope Sender, Not What You See in Your Inbox β€” Here's Why That Matters

SPF validates the envelope sender β€” the address used during SMTP delivery β€” not the "From" header address that recipients actually see. This means SPF can pass for an email that appears to be from ceo@bigcorp.com, because the attacker set a legitimate envelope sender from their own domain. Here's why DMARC's alignment requirement exists to close this gap, what -all vs ~all vs +all actually mean, and the SPF flattening trade-off.

By sadiqbd Β· June 18, 2026

Share:
SPF Validates the Envelope Sender, Not What You See in Your Inbox β€” Here's Why That Matters

An SPF record can be technically correct β€” every mechanism valid, every syntax right β€” and still "soft fail" for some legitimate senders because SPF has no mechanism for verifying the From header address that users actually see in their email client

The previous articles on this site covered the 10-lookup limit (PermError), SPF mechanisms in depth, and international email compliance. This article addresses a fundamental architectural limitation of SPF: SPF validates the "envelope sender" (the MAIL FROM address used during SMTP delivery) β€” not the "From" header address (the sender address the recipient's email client displays). This distinction is the source of much SPF-related confusion and the core reason SPF alone is insufficient for anti-spoofing.


Two "from" addresses in every email

Every email actually contains two different "sender" concepts:

The envelope sender (MAIL FROM / Return-Path): the address used during the SMTP protocol conversation between mail servers β€” specifically, the address the receiving server uses for bounce messages ("if you can't deliver this, send the bounce notification here"). This address is machine-readable and used for delivery mechanics β€” it never appears in email clients' standard "From:" display.

The header From: the address displayed by email clients in the "From:" field β€” what the recipient actually sees and associates with "who sent this email." This is what a sender's display name and email address appear as when you open an email.

SPF validates only the envelope sender β€” it checks whether the IP that sent the email is authorized to send on behalf of the MAIL FROM domain. It says nothing about whether the header From address is legitimate.


Why this creates a spoofing gap

An attacker wanting to impersonate ceo@bigcorp.com can:

  1. Set their header From to ceo@bigcorp.com (this is trivial β€” you can put any address in a header From)
  2. Set their envelope sender to their own domain, attacker@phishing-domain.com
  3. Configure SPF correctly for phishing-domain.com

Result: SPF passes for phishing-domain.com (the envelope sender domain is legitimate, the IP is authorized), but the recipient sees an email that appears to be from ceo@bigcorp.com.

This is called a "display name spoof" or "header From spoof" β€” it's completely unaddressed by SPF, because SPF doesn't look at the header From at all.


Why DMARC exists: closing the alignment gap

DMARC was specifically designed to address this limitation. DMARC adds an "alignment" requirement: for DMARC to pass, either SPF or DKIM must pass and the authenticated domain must align with the header From domain.

SPF alignment: the envelope sender domain (which passed SPF) must match (or be a subdomain of) the header From domain.

DKIM alignment: the domain in the DKIM signature's d= tag must match (or be a subdomain of) the header From domain.

This closes the spoofing gap: an attacker can't pass SPF for phishing-domain.com and simultaneously satisfy DMARC for bigcorp.com β€” because DMARC requires the authenticated domain to match the displayed header From domain.

This is why "SPF alone" is considered insufficient for spoofing protection, and why the previous DMARC articles on this site emphasized that SPF is one component of a three-part system (SPF + DKIM + DMARC), not a standalone solution.


The "+all", "-all", "~all" trailing mechanism and what each means

SPF records end with a "catch-all" mechanism that determines what happens when an email comes from an IP not covered by any earlier mechanism:

-all (HardFail): reject/fail emails from any IP not explicitly authorized. This is the strictest setting β€” in theory, the correct choice for a production domain where you know all legitimate sending IPs.

~all (SoftFail): mark as suspect, but don't reject. Commonly used during SPF deployment when you're not yet confident you've captured all legitimate senders β€” a "fail but deliver" that allows gradual refinement without blocking legitimate mail while you're still learning your sending infrastructure.

?all (Neutral): no assertion either way β€” "I have an SPF record but I make no claim about whether non-matching IPs are legitimate." Almost never useful in practice.

+all (Pass all): explicitly pass all IPs β€” effectively making the SPF record meaningless, since every IP passes. A serious misconfiguration that provides zero protection.

The common advice: use ~all during initial SPF deployment, monitor for PermError/SoftFail issues, then move to -all once you've confirmed all legitimate sending IPs are covered. Moving to -all prematurely can block legitimate email from sending infrastructure you hadn't yet accounted for.


SPF flattening: addressing the 10-lookup problem differently

The previous article covered PermError from exceeding the 10 DNS-lookup limit. One common solution is "SPF flattening" β€” replacing include: mechanisms (which consume DNS lookups) with the resolved IP addresses directly:

Instead of:

v=spf1 include:mailprovider.com include:crm.com -all

You resolve what those include: mechanisms expand to and write the IPs directly:

v=spf1 ip4:192.0.2.0/24 ip4:203.0.113.0/24 ip4:198.51.100.128/25 -all

The trade-off: ip4: directives don't consume DNS lookups (they're already IP addresses), so you can include many IPs without hitting the limit. But: if your mail provider changes their IP ranges (which they do, periodically, without always notifying customers) β€” your flattened SPF record immediately becomes outdated and starts SoftFailing legitimate mail. You've traded a reliability-of-lookup problem for a maintenance-of-accuracy problem.

Various "SPF flattening services" exist that automate this β€” monitoring your include: chains, detecting when IPs change, and automatically updating the flattened record. If you use SPF flattening, using such a service rather than doing it manually is generally advisable.


How to use the SPF Lookup on sadiqbd.com

  1. Check your record's structure: verify the mechanisms, the order they appear in, and the trailing catch-all (-all vs ~all) β€” ensuring the intent matches the deployment phase you're in
  2. Count lookup-consuming mechanisms: include:, mx, a, exists, redirect each consume lookups β€” if your total is approaching 10, the PermError article's guidance applies
  3. Look for +all: this is a critical misconfiguration β€” a record ending in +all provides no protection regardless of what precedes it; if your lookup shows this, it's an urgent fix
  4. Cross-reference with DMARC: SPF pass alone doesn't address header-From spoofing; DMARC alignment is what ties SPF validation to the address the recipient sees

Frequently Asked Questions

If SPF doesn't protect the header From, why is it still required? SPF remains a required component of email authentication infrastructure for several reasons. First, DMARC's SPF-alignment check does use the SPF result β€” DMARC elevates SPF from "check envelope sender" to "check that the envelope sender's domain aligns with the header From domain." Second, SPF contributes to spam-filter scoring independently of DMARC β€” a PermFail or SoftFail can influence whether mail is delivered to inbox vs spam, even without DMARC. Third, many receiving systems still apply SPF checks independently. SPF alone is insufficient; SPF as part of SPF + DKIM + DMARC is the complete stack.

Is the SPF Lookup free? Yes β€” completely free, no sign-up required.

Try the SPF Lookup free at sadiqbd.com β€” check any domain's SPF record, mechanisms, and lookup count instantly.

Share:
Try the related tool:
Open SPF Lookup

More SPF Lookup articles