Skip to content
  • There are no suggestions because the search field is empty.

Common SPF mistakes

When an SPF record is "not working," the record is rarely broken in some mysterious way. Usually it doesn't describe how you actually send: a service is missing, someone checked the wrong domain, a vendor's sample got pasted in as a second record, or the record quietly grew past 10 lookups. One mistake is worse than failing: +all, which makes SPF pass for everyone. Use this list to find which one you have, then follow the link for the full fix.

Why SPF fails: the usual causes

These make legitimate mail fail SPF.

1. A sending service is missing from the record

If a service sends with your domain in MAIL FROM and isn't in your record, its mail fails SPF. That's typically what "SPF failed for IP" in a header or bounce is telling you: the connecting IP wasn't authorized. Such messages might fail SPF and be rejected or sent to spam.

Find the gaps in two places: your DMARC aggregate reports, which list every source sending as your domain along with its SPF result (How to inventory sending sources, A field-by-field walk-through of a DMARC aggregate report), and each vendor's setup documentation. If reports show a source nobody recognizes, see Reports show sources we do not recognize.

Before adding an include, check item 7. Many platforms use their own bounce domain, and then your record isn't the one being checked at all.

2. Too many DNS lookups (permerror)

More than 10 lookup-causing terms (include, a, mx, ptr, exists, redirect), counting the ones nested inside your includes, gives permerror. SPF then can't pass for any message whose check goes over the limit. What counts and how to get under the limit: The 10-lookup limit and SPF permerror. Step-by-step fix: SPF permerror: too many DNS lookups.

3. More than one SPF record (permerror)

Two TXT records starting with v=spf1 at the same name also give permerror. Merge them into one: Multiple SPF records (why that is invalid), with the quick fix in Two SPF records.

4. Typos and stray characters

Any syntax error anywhere makes the whole record permerror. Common ones include:

  • A trailing period: include:spf.protection.outlook.com.
  • An equals sign: include=spf.protection.outlook.com
  • A space after the colon: include: spf.protection.outlook.com

Add to that: extra spaces or wrong quotation marks (typos, extra spaces, or the incorrect use of quotation marks can make the SPF record invalid), split strings that join without a space, and truncated addresses like ip4:192.0.2 instead of ip4:192.0.2.0/24. Correct syntax is in How to write an SPF record.

5. Includes or hosts that no longer exist

An include: pointing at a domain with no SPF record gives permerror. And receivers should stop after two DNS lookups that come back empty, which also gives permerror. Both usually mean an old vendor or a deleted hostname is still in the record.

6. Forwarded mail

When a message is forwarded, the forwarder sends it from its own IP, so SPF often fails at the next hop even with a perfect record. Even a correctly set up record can fail on forwarded messages. There's nothing to fix in your SPF record. Aligned DKIM is what usually carries the message through (Email forwarding, SRS, and ARC, Forwarded mail fails DMARC).

Looking at the wrong thing

7. Checking or editing the wrong domain

SPF is checked for the MAIL FROM (Return-Path) domain, not the From address people see. Even the instructions provided by some email service providers confuse this issue.

Compare these two lines in a delivered message:

Return-Path: <bounces@mail.vendor.example>
From: "Example Co" <news@example.com>

Here SPF was checked for mail.vendor.example. Your example.com record didn't matter. The receiver's Authentication-Results header confirms it with smtp.mailfrom=. The full explanation is in Envelope From vs Header From.

Two more versions of the same mistake:

  • Subdomains. bounce.example.com doesn't inherit example.com's record. Each name used in MAIL FROM needs its own.
  • A custom bounce domain without its record. If a platform reports "SPF record not found for custom MAIL FROM domain," it checked the bounce subdomain you configured and didn't find the record it expects there. Its setup page lists what to publish.

No SPF record found

A checker or bounce saying "no SPF record found" can mean several things:

  • There really is no record.
  • You (or the checker) looked at the visible From domain, while mail uses a different MAIL FROM domain, or the other way round.
  • The record name has a typo, or the record is on the wrong subdomain.
  • The record is over the lookup limit. Error messages vary and might include warnings that you don't have an SPF record, even if you do have one.

Check the domain in Return-Path first, then look up the TXT records at exactly that name.

8. Expecting an SPF pass to mean a DMARC pass

SPF can pass for a vendor's bounce domain while DMARC still has no aligned SPF result for you. DMARC only counts an SPF pass when the MAIL FROM domain is aligned with the From domain. That isn't an SPF mistake. It's an alignment gap, fixed with a custom bounce domain under your domain or with aligned DKIM (Identifier alignment for SPF and DKIM).

Mistakes that make SPF too permissive

These don't cause failures. They cause passes you didn't intend.

9. +all or a bare all

The default qualifier is +, so all and +all both authorize every IP address on the internet. Avoid those endings. Anyone can then pass SPF for your domain, and that pass can also satisfy DMARC if the envelope sender is aligned with your From address. End sending-domain records with ~all, which we recommend, and never +all (Softfail vs fail (~all vs -all)).

10. Wide or shared IP ranges

A /16 authorizes 65,536 addresses. Avoid using broad, shared IP address ranges (often used for cloud hosting) in your SPF record. List the specific addresses or the vendor's documented include instead.

11. Includes you haven't vetted

An include authorizes everything the other domain lists. SPF authorizes servers, not customers, so anyone sending through the same shared platform may pass for your domain once you include it. Add only includes a vendor documents, and remove them when you stop using the vendor. A source you must list but don't want counted can be given the ? qualifier; that's an advanced option (SPF mechanisms: include, a, mx, ip4, ip6, redirect).

Copy-paste mistakes

12. Pasting a vendor's full sample record

A vendor's sample usually looks like v=spf1 include:_spf.vendor.example ~all. Pasted as a new record, it creates a second SPF record (item 3). Pasted into the middle of yours, its ~all ends your record early, and everything after it is ignored. Only the include: belongs in your record.

13. Copying a template or another domain's record

Templates and generators often start with a mx or carry example IPs that have nothing to do with your mail. In most cases, a and mx are no longer the best choice. Write the record from your own sender list.

14. ptr and obsolete records

Don't publish ptr. Delete leftover v=spf2.0 (Sender ID) records and old SPF-type DNS records.

Maintenance mistakes

15. Never removing old senders

Stale includes waste lookups and keep authorizing vendors you've left. Remove any include for a third party that no longer sends mail for your domain. Audit the record at least annually, and more often if you can.

16. No SPF on domains that don't send mail

Parked and brand-protection domains should publish v=spf1 -all, so receivers can tell any mail using them is unauthorized.

17. Changing the record without a transition

Mail already in transit may be checked against the new record. Keep old senders authorized until you're sure they've stopped.

18. A flattened record that went stale

If you replaced includes with IP addresses to save lookups, those addresses don't update themselves. Review them regularly, and don't flatten Microsoft 365 (The 10-lookup limit and SPF permerror).

How SPF failures show up

For recognition; the fixes are above.

  • Headers: Authentication-Results: ... spf=softfail, spf=fail, spf=permerror, or spf=temperror, plus smtp.mailfrom= showing the domain checked.
  • Gmail bounces: 550 5.7.26 when the MAIL FROM domain has -all and the IP didn't pass; 550 5.7.26 when neither SPF nor DKIM passed (Gmail requires all senders to authenticate with either SPF or DKIM); 421 4.7.27 or 550 5.7.27 when bulk mail didn't pass SPF authentication; and 451 4.7.24 or 550 5.7.24 for a record with one or more suspicious entries, which isn't defined further.
  • Exchange Online: 5.7.23, the message was rejected because of an SPF violation.
  • DMARC aggregate reports: the SPF result and the domain checked, per sending source. Our DMARC reporting and visual analysis shows these by source, which is usually the quickest way to see which of the mistakes above you're dealing with.

A clean SPF result won't by itself get mail out of spam. If your SPF is valid and mail still lands there, the cause is often something other than SPF; see Why are my emails going to spam.

Free DMARC account

Turn raw DMARC reports into a readable dashboard

Point your rua address to our platform and read the results by sender and source instead of opening XML files.

  • Results grouped by sending source
  • SPF, DKIM and alignment results per sender
  • The original XML reports are still there to download

Create a free DMARC accountTalk to an expert

FAQ

Why is SPF failing when the record looks right?

Check four things: that you're looking at the MAIL FROM (Return-Path) domain, that the sending service is listed, that it's the only SPF record at that name, and that it's under 10 lookups. If all four are fine, the message may have been forwarded.

Is +all ever OK?

No. It authorizes every server on the internet.

How often should I review my SPF record?

At least once a year, and whenever you add or drop a sending service.