To fix an SPF record, first look up the TXT record on your domain and read the failure in a bounced message or authentication header. Then merge any duplicate records into one, remove senders you no longer use to stay under the 10 DNS lookup limit, add every real sender, fix typos, and end the record with ~all while testing and -all once every sender is confirmed.
Key takeaways
- SPF is checked against the Return-Path domain, not the From address you see in your inbox.
- Two SPF records on one domain and more than 10 DNS lookups both return a permerror, which receivers treat as a failure.
- Fix one thing at a time, wait for DNS to propagate, and retest before tightening the record to -all.
Your mail is landing in spam, or bouncing outright, and the SPF record looks fine at first glance. That is the usual story: SPF failures are rarely exotic, and most come from a short list of mistakes you can find in minutes.
What is an SPF record?
An SPF record is a TXT record in your domain's DNS that lists which servers are allowed to send email for your domain. Receiving mail servers check it before deciding whether to accept, quarantine or reject a message.
SPF is defined in RFC 7208, published by the IETF in April 2014. The record always starts with v=spf1, followed by mechanisms such as include:, ip4:, a and mx, and ends with an all mechanism such as ~all or -all.
A typical record for a domain using Google Workspace looks like this: v=spf1 include:_spf.google.com ~all. It says Google's servers may send mail for the domain, and anything else should be treated as suspicious.
How is SPF actually checked?
SPF is checked against the Return-Path domain, also called the envelope sender, not the From address your recipient sees. This one detail explains about half of all SPF confusion.
When a receiving server gets a message, it reads the domain in the Return-Path, looks up that domain's SPF record, and checks whether the connecting server's IP address is authorized. The result is recorded in the message headers, usually on an Authentication-Results line as spf=pass, spf=fail, spf=softfail or spf=permerror.
That means mail can pass SPF and still fail DMARC. If your Return-Path domain is different from your From domain, SPF does not align, and DMARC needs DKIM alignment instead. Our guide to what DMARC is explains alignment in more detail.
How do I find out what is wrong with my SPF record?
Diagnose before you edit. Start with the evidence, not with a guess, and change one thing at a time so you know which change fixed the problem.
- Look up the record. Run
dig TXT example.comor use a free SPF checker. Check that exactly one TXT record starts withv=spf1. - Read the failure. Open a bounced or spam-folder message and find the
Authentication-Resultsheader. Note whether it saysspf=fail,spf=softfail,spf=permerrororspf=none, and note thesmtp.mailfromdomain it checked. - List every sender. Write down everything that sends mail as your domain: your mailbox provider, CRM, helpdesk, invoicing tool, marketing platform, contact forms and your website server.
- Compare the two lists. Any sender on your list that is not in the record is a suspect. So is any mechanism in the record that no longer sends mail.
You can run the lookup step in seconds with the free SPF checker, which shows your record and flags common problems.
What are the most common SPF errors?
Eight mistakes cause nearly every SPF failure. The table below gives the short version; the sections after it show the broken and fixed record for each one.
| Error | What receivers see | Fix |
|---|---|---|
| Two SPF records | permerror | Merge into one record |
| More than 10 DNS lookups | permerror | Remove includes, use ip4, split by subdomain |
| Missing sender | fail or softfail | Add the provider include or IP |
| Wrong ending (~all / -all / ?all) | fail, softfail or no protection | ~all while testing, -all when complete |
| +all | pass for everyone | Remove it immediately |
| Syntax typos | permerror or none | Fix spelling, spaces and quotes |
| Record over 255 characters per string | permerror or truncated record | Split into quoted strings at spaces |
| SPF passes but DMARC fails | dmarc=fail | Align the Return-Path or rely on DKIM |
How do I fix multiple SPF records?
Merge them into one record and delete the other. RFC 7208 allows only one SPF record per domain, and two records starting with v=spf1 return a permerror, which most receivers treat as a failure.
Broken: two separate TXT records, v=spf1 include:_spf.google.com ~all and v=spf1 include:spf.example-crm.com ~all. Fixed: one record, v=spf1 include:_spf.google.com include:spf.example-crm.com ~all. Note there is only one ~all, at the end.
This happens often when different people set up different tools over the years. Each setup guide tells you to add a record, and nobody checks whether one already exists. Check your DNS zone for every TXT record on the root domain before adding another.
How do I fix the SPF 10 lookup limit?
Remove senders you no longer use, replace includes with IP addresses where you control the servers, and move some sending to a subdomain. RFC 7208 caps SPF evaluation at 10 DNS-querying terms, and exceeding it returns a permerror for every message.
The mechanisms include, a, mx, ptr and exists each cost a lookup, as does the redirect modifier, and lookups nested inside an include count too. The mechanisms ip4, ip6 and all cost nothing.
Three practical ways back under the limit:
- Audit and delete. Remove every include for a tool you stopped using. Old marketing platforms and retired helpdesks are the usual culprits.
- Use ip4 for servers you control. If your own mail server has a fixed IP,
ip4:203.0.113.10costs no lookup, whileaormxcosts one. - Split by subdomain. Send marketing mail from a subdomain such as
mail.example.comwith its own SPF record and its own 10-lookup budget.
Avoid the ptr mechanism entirely. RFC 7208 discourages it because it is slow and unreliable, and it wastes a lookup.
How do I fix a missing sender in SPF?
Add the sender to your single SPF record using the include or IP address from that provider's own setup documentation. A record can be perfectly formatted and still fail if it never names the service that sent the message.
For example, if your record is v=spf1 include:_spf.google.com ~all but your CRM also sends mail as your domain, add its include: v=spf1 include:_spf.google.com include:spf.example-crm.com ~all. Use the exact include value from the provider's docs, not a guessed one.
Walk through your full sender list: mailbox, CRM, helpdesk, invoicing, marketing platform, contact forms and any server that sends password resets or order confirmations. If a website contact form sends from your domain through your web host, that host's IP or include needs to be listed too.
Which ending should my SPF record use?
Use ~all while you are still confirming every sender, and switch to -all only once testing shows all legitimate mail passes. The ending decides what receivers do with mail from unlisted servers.
Google's troubleshooting guide warns that a hyphen can be overly restrictive and cause delivery problems for legitimate mail if any sender is missing, while a question mark does not authenticate outgoing messages at all. Start with ~all, watch your results for a week or two, then tighten to -all.
If you find +all in your record, remove it today. It authorizes every server on the internet to send as your domain. It is usually left behind by someone trying to stop failures quickly, and it trades a deliverability problem for a spoofing problem.
How do I fix SPF syntax typos and long records?
Re-type the record carefully, checking every character, because typos, extra spaces and wrong quotation marks can make the whole record invalid. Common mistakes include a missing colon after include, a space inside an IP address, and smart quotes pasted from a document.
Check the spelling of every include value against the provider's documentation. One wrong letter means the include points at a domain that does not exist, and the lookup fails.
If the record is longer than 255 characters, split it into multiple quoted strings inside the same TXT record, breaking only at spaces, never in the middle of a token such as include: or ip4:. Most DNS providers handle this automatically, but if yours does not, add the quotes yourself at space boundaries.
Also confirm you published a TXT record, not the obsolete SPF record type. RFC 7208 deprecates the SPF record type, and publishing both can cause a permerror.
Why does SPF pass but DMARC still fail?
SPF passes but DMARC fails when the Return-Path domain does not match the From domain. SPF checked the wrong domain for DMARC's purposes, even though it checked the right one for its own.
Fix this in one of two ways. Configure a custom Return-Path on your own subdomain with your sending service, so SPF aligns with the From domain. Or make sure DKIM signs with your domain and aligns, because DMARC passes if either SPF or DKIM aligns.
This is common with bulk senders and marketing platforms, which often use their own Return-Path domain by default. It is also one reason Google and Yahoo require SPF, DKIM and DMARC from bulk senders sending at least 5,000 messages per day, as Google's SPF troubleshooting guide explains.
Check your setup with the free DMARC checker alongside the SPF checker.
How do I test an SPF fix?
Wait for DNS to propagate, send a test message to a mailbox you control, and read its Authentication-Results header. Google notes it can take up to 48 hours for SPF changes to take effect, so do not judge the fix after five minutes.
- Confirm propagation. Query the record from a public DNS tool and confirm the new value is visible.
- Send a test from every sender. Mailbox, CRM, helpdesk, invoicing and website forms each need their own test message.
- Read the headers. Look for
spf=passand, if you use DMARC,dmarc=passon each test. - Watch DMARC reports. If you publish DMARC at
p=none, the aggregate reports show which senders still fail, which is the most reliable way to catch a sender you missed. - Tighten only when clean. Move from
~allto-alland DMARC towardp=rejectonly after a clean week of reports.
If a test still fails, re-read the header: the smtp.mailfrom value tells you exactly which domain was checked, and that domain may not be the one you edited. Subdomains need their own records.
What mistakes should I avoid when fixing SPF?
Do not copy an SPF record from another company, do not add includes you cannot identify, and do not edit three records at once. Each of these turns a small fix into a bigger problem.
- Copying a record blindly. Another company's includes authorize their senders, not yours, and may push you over the lookup limit.
- Adding an include for every tool you have ever tried. Each include costs lookups and widens your attack surface. Remove what you do not use.
- Using -all on day one. One missing sender means its mail gets rejected until you notice.
- Forgetting subdomains. Mail from
mail.example.comis checked against that subdomain's record, not the root domain's. - Ignoring forwarding. Forwarded mail often fails SPF because the forwarder's server is not in your record; DKIM usually survives forwarding, which is another reason to publish it.
For a wider check of your domain's email setup, see our guide to DKIM.
The small business cybersecurity checklist covers email authentication alongside backups, updates and device security.
The bottom line
Fixing an SPF record is mostly detective work: find the one record, read the failure, list every sender, and fix one mistake at a time. The two errors that catch most people are duplicate records and the 10 lookup limit, and both are cheap to fix once you see them.
Publish one clean record, end it with ~all while you test, and move to -all only when every sender passes. You can verify the result in seconds with the free SPF checker.
Frequently asked questions
How do I check my SPF record?
Look up the TXT records for your domain with a DNS lookup tool or the command dig TXT example.com, replacing example.com with your domain. You should find exactly one record starting with v=spf1. Cysoro also offers a free SPF checker that shows the record and counts its DNS lookups.
Why does my SPF record fail even though it looks correct?
The most common reason is a missing sender: a service that sends mail for your domain is not listed in the record. Another common cause is exceeding the 10 DNS lookup limit, which returns a permerror even when every listed sender is correct.
Can I have two SPF records on one domain?
No. RFC 7208 says a domain must publish only one SPF record. Two records starting with v=spf1 return a permerror. Merge all mechanisms into a single record and delete the other one.
What is the SPF 10 lookup limit?
RFC 7208 allows at most 10 DNS-querying terms during one SPF evaluation. The mechanisms include, a, mx, ptr and exists each count, including lookups nested inside an include. The ip4, ip6 and all mechanisms cost no lookups.
Should I end my SPF record with ~all or -all?
Use ~all (softfail) while you are still confirming that every sender is listed, because -all tells receivers to reject mail from unlisted servers. Move to -all only after testing shows all legitimate mail passes.
How long does an SPF fix take to work?
DNS changes usually take effect within a few hours, but Google notes it can take up to 48 hours for SPF authentication to start working after you add or change a record. Wait and retest rather than making more changes in the meantime.
Does SPF stop phishing from my domain?
SPF helps, but on its own it does not stop phishing. SPF is checked against the Return-Path domain, so it cannot protect the From address unless it is combined with DKIM and DMARC with alignment. Publish all three for real protection.
What does +all mean in an SPF record?
The +all mechanism authorizes every server on the internet to send mail as your domain, which makes the record useless. Remove it and list only your real senders.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against RFC 7208, Google Workspace SPF troubleshooting guidance and published SPF error guides.
How we write and fact-check →