What SPF Email Authentication Checks and Why It Matters
SPF checks the envelope sender, not the From: header. What that means, how SPF feeds DMARC alignment, and what Gmail's SPF errors are telling you.
Someone told you to set up SPF, and gave no more detail than that. SPF email authentication is a DNS record that lists the servers allowed to send mail for your domain. A receiving server checks the actual sending server against that list. A server that appears in the record gets a pass. A server that is missing from it gets whatever result the record's all mechanism gives, such as fail or softfail. That is the whole mechanism, and the details matter more than the setup step.
What SPF actually checks
SPF does not look at the address your reader sees. It checks the envelope sender, the MAIL FROM address from the SMTP conversation. This is the address bounces go back to, and it can differ from the From: header in the message body.
Your domain publishes a DNS TXT record listing the IP addresses and servers allowed to send as you. Gmail's guidelines say the SPF record for your domain should include all email senders for your domain. When mail arrives, the receiving server reads that record and compares it to the connecting server. Gmail's guidelines say SPF prevents spammers from sending unauthorized messages that appear to be from your domain.
A pass means one thing: the server that connected is one you authorized. A pass says nothing about whether the body of the message is truthful, and nothing about who really set the From: header. A spammer who controls a listed server can still send anything. SPF narrows who can use your domain, and it stops there.
What SPF does not check
The From: header is what DMARC calls the Author Domain. DMARC's standard says the Author Domain is the domain name of the apparent author as extracted from the RFC5322.From header field. SPF never validates that header on its own. It validates the MAIL FROM identity. DMARC's standard says DMARC relies solely on SPF validation of the MAIL FROM identity. The term "SPF Domain" means an SPF-validated MAIL FROM identity.
This gap is why a pass proves less than senders assume. Mail can carry a From: header your domain never wrote, and SPF can still pass if the envelope sender lines up with an authorized server. The From: header is only protected when alignment ties the two together.
SPF and DMARC alignment
DMARC is the rule that connects SPF to the From: header. Gmail's guidelines say DMARC tells receiving servers what to do with messages that don't pass SPF or DKIM. To pass DMARC, the authenticated domain and the visible sender have to match, and how closely is the alignment policy.
Google Workspace Help says the aspf tag sets the alignment policy for SPF, which specifies how strictly message information must match SPF signatures. Relaxed alignment is the default. Google Workspace Help says relaxed SPF alignment requires the From header domain to match or be a subdomain of the Envelope-Sender address domain. Strict alignment requires an exact match between the Envelope-Sender address domain and the From header address domain.
DMARC's standard says relaxed alignment means the Author Domain and the Authenticated Identifier share the same Organizational Domain. Strict alignment means the two are identical. Domain name comparisons for alignment are case-insensitive.
A passing SPF record is not enough on its own. DMARC's standard says a message passes the DMARC check if one or more Authenticated Identifiers align with the Author Domain. No alignment, no DMARC pass, whatever the SPF result says.
SPF and DKIM
DKIM covers what SPF cannot. Yahoo's guide says senders should authenticate every email with DKIM, which creates a signature of the content of the message.
Gmail's guidelines say to pass DMARC authentication, messages must be authenticated by SPF or DKIM, or both. Gmail's FAQ says bulk senders must set up both SPF and DKIM, but only one needs to be aligned. Gmail's FAQ says bulk senders must align the From: header domain with either the SPF or the DKIM organizational domain. Yahoo's FAQ says Yahoo evaluates all DKIM signatures and uses the results to determine DMARC alignment.
So if you already have DKIM, a bulk sender still needs SPF. Gmail's guidelines say all senders must set up SPF or DKIM email authentication for their sending domains, and Gmail's FAQ says messages that aren't authenticated with both SPF and DKIM can get temporary or permanent failure codes, or spam foldering. Each method fails in different situations, and the other one covers the gap.
Common SPF failures
The usual failure is a sender missing from the record. Your newsletter tool, your CRM, or your billing system sends from its own servers. Gmail's guidelines say if third-party senders are not in your SPF record, their messages are more likely to be marked as spam. Every tool that sends as your domain belongs in the record, and the vendor publishes the include you need.
Gmail's errors name the problem directly. Gmail's FAQ says error code 4.7.27 means SPF authentication didn't pass. A 5.7.27 error means Gmail blocked the message because it did not pass SPF. Gmail's guidelines also say messages that are not authenticated might be marked as spam or rejected with a 5.7.26 error.
Where SPF fits in the sender checklist
Authentication is one input among several. Many receivers run these checks whether or not you publish a DMARC policy. DMARC's standard says many Mail Receivers run the underlying authentication checks even when no DMARC Policy Record exists for the message's Author Domain. It also says a Mail Receiver performs SPF checks, DKIM checks, and a DMARC Policy Record lookup before replying to the DATA command.
Google Workspace Help says you must turn on SPF or DKIM for your domain before you can use DMARC. So SPF or DKIM comes before DMARC in the setup order. After that, the other sender rules still apply. Get the record right, get DKIM beside it, and let DMARC tie both to the name your readers see.
Sources
Filed