Why Your Email Failed SPF and What to Do

An SPF failure means the MAIL FROM identity did not check out. Here is what that means, why honest mail fails it, and how to find the cause.

An SPF failure does not mean your email was spoofed. It means the receiving server checked the MAIL FROM identity against your SPF record and did not find a match. The message may still have been delivered. It may have gone to spam. It may have been rejected. The failure itself tells you none of that, so read the signals before you change anything.

What an SPF failure means

SPF lives in your DNS as a record naming every server that may send mail as your domain. Gmail's guidelines say SPF prevents spammers from sending unauthorized messages that appear to be from your domain. When a message arrives, the receiver looks up that record and checks the connecting server against it.

The check runs on the MAIL FROM identity, the address used in the SMTP envelope, not the From: header the reader sees. SPF's standard says the SPF results are pass, fail, softfail, neutral, none, temperror and permerror. Gmail's guidelines say the SPF record for your domain should include all email senders for your domain. A sender that is missing from the record does not pass, even when the mail is honest.

Why legitimate mail fails SPF

The most common cause is a sender you forgot. A billing system, a CRM, a printer, a form tool on your website. Each one sends mail as your domain. If it is not in the record, its mail does not pass SPF.

Third-party tools cause the same problem at a larger scale. Gmail's guidelines say if third-party senders are not in your SPF record, their messages are more likely to be marked as spam. If you use an email service provider, Gmail's guidelines say to verify that they authenticate your domain's email with SPF and DKIM.

Forwarding breaks SPF by design. The record lists your servers. A forwarder sends your message from its own servers, so the check at the final receiver fails.

How SPF failure feeds into DMARC

SPF pass alone is not enough, because DMARC adds a second test called alignment. The DMARC standard says a message needs alignment between the Author Domain and an Authenticated Identifier to achieve a DMARC pass. The Mail Receiver takes the domain from the RFC5322.From header field as the Author Domain.

For SPF, the identifier is the MAIL FROM domain. The standard calls this the SPF Domain, an SPF-validated MAIL FROM identity. Relaxed alignment means the Author Domain and the Authenticated Identifier share the same Organizational Domain. Strict alignment means the Author Domain is identical to the Authenticated Identifier.

So a message can pass SPF and still fail DMARC. Your ESP sends with its own envelope domain, SPF passes on that domain, but it does not align with your From: header domain. Google Workspace Help says relaxed SPF alignment is the default and accepts any valid subdomain of the domain name. That default covers most setups. Google Workspace Help also warns that strict alignment can send messages from associated subdomains to spam.

Can a message still pass DMARC if SPF fails? Yes. 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. An aligned DKIM signature can still give a DMARC pass when the SPF check failed.

What receivers do with a failed message

Gmail's guidelines say messages that are not authenticated might be marked as spam or rejected with a 5.7.26 error. Gmail's FAQ says error code 4.7.27 means SPF authentication didn't pass. Error code 5.7.27 means the message was blocked because it didn't pass SPF authentication.

Gmail's FAQ says messages that aren't authenticated with both SPF and DKIM can get temporary or permanent failure codes, or spam foldering. A rejection is loud and easy to see. Spam foldering is quiet, and the reader never tells you.

DMARC decides what happens next. Gmail's guidelines say DMARC tells receiving servers what to do with messages that don't pass SPF or DKIM. Gmail's FAQ says messages that fail DMARC are handled based on the sending domain's DMARC policy. The DMARC standard adds that messages that fail the DMARC check are handled by the Mail Receiver's local policies. So you control the policy, and each receiver chooses how strictly to apply it.

One more thing the standard says, and it matters for your reputation. A message that fails DMARC validation is not necessarily associated with the Author Domain and should not affect that domain's reputation.

How to diagnose the cause

Start with DMARC aggregate reports. The DMARC standard says aggregate reports can reveal mail streams using the Author Domain that do not pass DMARC validation checks. The standard says failing mail streams may be illegitimate uses like spoofing or legitimate uses that lack aligned Authenticated Identifiers.

Each report row shows the SPF result for one stream. The standard says the preserved SPF results must include "pass" or "fail" and the domain name used for the SPF check. That domain name is the clue. If it is your ESP's envelope domain, you have an alignment problem. If SPF failed outright, the connecting server was not in your record, and the report shows which one.

Gmail's guidelines say DMARC reports help you identify senders that may be impersonating your domain. Google Workspace Help says the same, that DMARC reports help you identify possible authentication issues and malicious activity. Read the bounce text too. A rejection names the code, and the code names the check.

Fix order: SPF and DKIM first, then the policy

Fix the mail streams before you publish a strict policy. The DMARC standard says shortcomings in legitimate mail streams must be fixed before the Domain Owner publishes an Enforcement policy for the Author Domain.

So the order is this. First, add every real sender to your SPF record. Second, get DKIM signing on your own domain for every stream, including your ESP's. Third, publish DMARC. The standard says Domain Owners usually start with a policy of p=none and a rua tag pointing to the mailbox that receives aggregate reports. The standard says starting at p=none makes sure nothing was missed in the initial SPF and DKIM deployments. A Domain Owner starting at p=none uses aggregate reports to audit its own mail streams' authentication configurations.

Then tighten the policy once the reports are clean. Do not start at enforcement. Starting at enforcement risks rejecting your own mail before every stream is fixed.

What an SPF failure is not

Two other things get blamed for SPF failures, and neither is the cause. Gmail's guidelines say messages sent from IP addresses on a blocklist are more likely to be marked as spam. A blocklist hit looks like an SPF problem because both land mail in spam. But a blocklist hit is a separate problem from an SPF failure. Some lists are dead, like SORBS, and a check against them tells you nothing.

The other is the one-click unsubscribe rule. It is a separate requirement with its own headers, and missing it does not cause an SPF fail. Read what those headers require if Gmail flagged your mail, but fix SPF on its own terms.

Gmail's guidelines say authenticated messages are less likely to be rejected or marked as spam by Gmail. That is the whole reward. Get every sender into the record, get DKIM aligned, then let the reports tell you when it is clean.

Sources

Filed

More filed under SPF and DKIM

  • How to find all DNS records for a domain
  • How to Set Up a DKIM Record for Your Domain
  • How to Set Up a DKIM Email Record
  • What a DKIM record is and what each part does
  • Can a Domain Have Multiple SPF Records?
  • What It Means When a Domain Has No SPF Record
  • How to Set Up an SPF Record for Your Domain
  • What SPF Email Authentication Checks and Why It Matters
  • How to Set Up a Gmail SPF Record
  • What an SPF Record Is and Where It Goes in DNS
  • SPF record syntax, tag by tag
  • What an SPF Record Is and How to Read Yours