SPF Record Generator
The whole SPF job in one place: read any domain’s record the way a receiving server does, build a new one from the services that send for you, and flatten it when it goes over the limit of 10 DNS lookups.
1. Which of these send email for this domain?
Check every service that sends mail using this domain's address - your inbox, your ESP, your CRM. Missing one means that sender's mail can fail SPF.
2. Anything else? (optional)
One mechanism per line, e.g. include:mail.example.com or ip4:203.0.113.10 for a server you send from directly.
3. What happens to mail that doesn’t match?
Your SPF record
Readyv=spf1 ~all
Publish this as a single TXT record at the root of your domain (host @). A domain can only have one SPF record - if one already exists, replace it rather than adding a second.
SPF Toolkit
How to create an SPF record, and what to check before you publish it
01What an SPF record does
An SPF (Sender Policy Framework) record is a TXT record in your DNS that lists the servers allowed to send mail for your domain. When a message arrives, the receiving server takes the domain from the envelope sender (the Return-Path address), looks up its SPF record and checks whether the IP address that delivered the message is on the list.
SPF is one of the three checks, with DKIM and DMARC, that Gmail and Yahoo expect from anyone sending in volume. A missing or broken record is one of the commonest reasons a new sending domain lands in spam.
02How to use the generator
- Tick every service that sends mail as your domain: your mailbox provider, your sending platform, your CRM, your support desk. Anything you leave out will fail SPF.
- Add any server you run yourself as an
ip4:orip6:entry. - Choose what happens to mail that does not match (see the next section) and copy the record.
- In your DNS, add one TXT record on the root of the domain (host
@) with that value. Replace any SPF record that is already there; do not add a second one. - Wait for the DNS cache to expire, then read the record back with the SPF Record Checker to confirm it is valid and under the lookup limit.
03~all or -all: what to put at the end
The last term says what a receiver should do with mail from a server that is not listed. ~all (softfail) says it is probably not yours: receivers usually accept it but mark it. -all (hardfail) says reject it. ?all says no opinion, and +all allows every server on the internet, which makes the record useless: never use it.
Start with ~all while you are still finding all your senders. Once DMARC reports show nothing legitimate is failing, -all is the stricter and cleaner choice. Note that DMARC treats softfail and hardfail the same way: both are a failed SPF check.
04The limit of 10 DNS lookups
SPF allows at most 10 DNS-querying terms while a record is evaluated. include, a, mx, ptr, exists and redirect each cost one, and so does everything inside an included record. ip4, ip6 and all cost nothing. Go over and the result is a permanent error, which counts as an SPF failure for every message you send.
It is easy to hit with a few providers, because each include pulls in that provider’s own nested includes. The generator shows the running count. If you are over, remove services you no longer use, move bulk senders to a subdomain with its own record, or use the SPF Flattening Tool to replace includes with the IP ranges they resolve to.
05Mistakes that break SPF
- Two SPF records on one domain. A domain may publish only one record that starts with
v=spf1. Two give a permanent error. Merge them into one. - Forgetting subdomains. A record on
example.comdoes not covermail.example.com. Every domain or subdomain that sends needs its own record. - Listing a service you cancelled. It wastes lookups and leaves a sender you do not control authorised.
- Using the wrong domain. SPF checks the envelope sender, which is often a domain your sending platform controls, not the From address people see. For DMARC the two have to align; the platform’s setup guide explains how to set a custom return path.
- Typos in the provider’s include. A misspelled include returns nothing, and two such misses make the record fail.
Frequently asked questions
What is an SPF record generator?
It builds the text of an SPF TXT record from the services that send email for your domain, so you do not have to write the syntax by hand. You still publish the record yourself in your DNS. This generator also counts the DNS lookups, because a record over 10 fails.
Where do I add an SPF record?
In the DNS settings of the service that hosts your domain's DNS (your registrar, Cloudflare, Route 53 and so on). Add a TXT record with host @ (the root of the domain) and the generated text as the value.
Can a domain have more than one SPF record?
No. Only one TXT record starting with v=spf1 is allowed per domain. If two exist, receivers return a permanent error and SPF fails. Combine all your senders into a single record.
Should I use ~all or -all?
~all (softfail) is the safe start while you are still finding every service that sends for you. -all (hardfail) is stricter and is a good end state once DMARC reports show that no legitimate mail fails. DMARC treats both as a fail.
Is the limit 10 includes?
No, it is 10 DNS lookups in total. Every include, a, mx, ptr, exists and redirect costs one, and so do the terms inside an included record. A record with only four includes can already be over the limit if those providers nest others.
Do I still need SPF if I have DKIM and DMARC?
Yes. DMARC passes if either SPF or DKIM passes and aligns with the From domain, and Gmail and Yahoo expect bulk senders to have both SPF and DKIM set up. Having both gives you a fallback if one breaks.
How long until a new SPF record works?
As long as the old record's TTL, often a few minutes to a few hours, occasionally up to 48 hours. Read the record back with the SPF Record Checker before you send.
SPF is one of the records that decide inbox placement. We audit the whole setup, restructure the sending services so SPF stays valid, and fix what’s wrong.
How we help: Consulting · Private infrastructure · Managed mailboxes · Monthly support