Email errors
SPF fail: softfail vs hardfail and how to fix each
SPF fail means the sending IP is not authorized by the domain's SPF record. See how softfail and hardfail differ and how to fix each one.
What this means
SPF fail means the server that delivered the message is not authorized to send for the domain that was checked. SPF (Sender Policy Framework) is the DNS record that lists those servers.
SPF softfail vs hardfail
The prefix on all, the term that catches any IP not matched earlier, usually sets the result:
fail(-all), or hardfail: the server is not authorized. The receiver's local policy decides what happens next.softfail(~all): the server is probably not authorized. RFC 7208 says receivers should not reject on this result alone.
Under RFC 9989, DMARC (the check against the visible From domain) treats both alike. It counts only an SPF pass on a domain that matches From under your DMARC alignment settings, so after either result DMARC depends on DKIM (a signature on the message). Microsoft adds that the DMARC policy is effectively ignored for ~all failures on messages without DKIM signatures.
SPF failure bounces and SPF validation error
A receiver that rejects on fail during delivery should reply 550. RFC 7372 assigns 5.7.23 (sample text SPF validation failed), and Microsoft documents 550 5.7.23 for bounces caused by the sending domain's SPF record. It lists an incomplete SPF record among the causes of 550 5.7.1, a code that also covers refusals unrelated to SPF, such as relaying denied. Read the text after the code.
SPF validation error is the sample text for 5.7.24 (or 4.7.24): the SPF check itself hit an error.
Why it happens
SPF checks the domain in the MAIL FROM command (the envelope sender), which can differ from the visible From address. Look for one of these causes:
- A real sender is missing. You added a mail server or third-party service without updating SPF. If its
include:is already there, check that it sits beforeall, because mechanisms afterallare ignored. - The message was forwarded. A forwarder or mailing list that keeps the original MAIL FROM connects from its own IP.
- You edited a different record. Each subdomain needs its own SPF record, so the one on
example.comsays nothing aboutmail.example.com. - Someone is forging the domain. Then the failure is correct.
How to fix it
- Open the full headers. In Gmail, click More next to Reply, then Show original. Find
spf=failorspf=softfailinAuthentication-Results. InReceived-SPF, the result is the first word. A message rejected during delivery has none of these headers: read the bounce, or send a test from the same source to a mailbox you control. - Note the checked domain (after
smtp.mailfrom=orenvelope-from=) and the IP (client-ip=inReceived-SPF, orCIP:inX-Forefront-Antispam-Reporton Microsoft 365). - Look up that domain with the SPF checker and compare its record with the IP. A
~allor-allinside aninclude:never sets your result. - Identify the IP, then act on it:
- Your server or provider: add
ip4:(orip6:) or the mechanism your provider documents, beforeall. Caution: edit the existing record. A second SPF record givespermerror(multiple SPF records), and so do more than 10 DNS lookups, nested ones included (too many lookups). - A forwarder or mailing list: leave your record alone. Look for
dkim=passwith aheader.d=domain aligned with From. With it, DMARC still passes. Without it, this message fails DMARC: make sure your domain signs with DKIM. - An IP you cannot identify: leave your record alone. Adding it would authorize that server.
- Your server or provider: add
- Decide on
~allor-alllast. Caution: RFC 9989 warns that, at some receivers,-allcan cause rejection before DMARC runs. Mail that would have passed DMARC through aligned DKIM can be lost, and those rejections never appear in aggregate reports. Move to-allonly after your DMARC aggregate reports show every sending service you use passing SPF.
Confirm the fix
- Give DNS time. Google says SPF can take up to 48 hours to start working.
- Send a new message from the same source to a mailbox you control.
- Look for
spf=passwith the samesmtp.mailfrom=domain. - In aggregate reports, find that
source_ipand readspfinauth_results. Inpolicy_evaluated,spfholds only the DMARC alignment result, so a softfail appears there asfail.