How to use the SPF generator
- Tick every service that sends email as your domain. Think beyond your mailbox provider: help desk, CRM, invoicing and newsletter tools all send mail with your address in the From line.
- Add servers you run yourself. Enter their IP addresses or ranges, or tick
mxif the servers that receive your mail also send it. - Choose the ending. Keep
~allwhile you are still finding senders. Tighten it to-alllater. - Copy the record and create a TXT record on the host
@in your DNS. If a record starting withv=spf1is already there, edit it instead of adding another. - Verify it with the SPF checker a few minutes later. The checker follows every nested include and reports the true lookup count.
The parts of an SPF record
| Term | Meaning | DNS lookups |
|---|---|---|
v=spf1 | Version. Required and must come first. | 0 |
include: | Authorises every server in another domain's SPF record, usually a provider's. | 1, plus any nested inside it |
ip4: / ip6: | Authorises one address or a CIDR range. | 0 |
a | Authorises the addresses in the domain's own A or AAAA record. | 1 |
mx | Authorises the servers named in the domain's MX records. | 1 |
~all / -all | What to do with every other server: soft fail or hard fail. Must come last. | 0 |
Why some services need no SPF include
Receivers check SPF against the Return-Path domain (the envelope sender), not the address in the From line. Many email platforms put their own domain in the Return-Path, or ask you to point a subdomain at them with a CNAME record and manage SPF behind it. In both cases your root record is never consulted for that mail, so adding the platform's include only spends one of your ten lookups.
The generator follows each vendor's own setup guide. Where the guide asks for an include, ticking the box adds it. Where it does not, the service is marked "no SPF include needed" with the reason and a link to the vendor's page. For those services DMARC passes through an aligned DKIM signature instead, so finish the DKIM step in the vendor's setup and confirm the key with the DKIM checker.
If your service is not listed, look for "SPF" in its domain authentication guide and paste the documented include under extra includes. Vendors change their setup over time, so the vendor's current page is the authority, not this list.
Staying under the limits
- 10 DNS lookups. The count shown by the generator covers only the terms in your record. Provider includes usually contain further includes, so a record with five or six services can already be over. See how to fix SPF PermError for too many DNS lookups.
- 255 characters per string. A longer record is still one TXT record, but it has to be published as several quoted strings. The generator shows the split version when you need it.
- One record per domain. Each subdomain that sends mail needs its own record, and each name may hold only one.
When a record gets crowded, move a service to its own subdomain, such as news.example.com for marketing mail. Every subdomain has its own SPF record and its own budget of ten lookups, and problems with one mail stream stop affecting the others. The details are in using a subdomain for sending email.
Common mistakes
- Adding a second
v=spf1record when a new service says "add this SPF record". Merge the include into the existing record. - Leaving includes for services you stopped using. Each one still costs a lookup and still authorises that provider's servers.
- Writing
include=, adding a space after the colon, or ending a domain with a dot. Any syntax error invalidates the whole record. - Listing a very large IP range to be safe. Everyone inside the range can then send as your domain.
After SPF: DKIM, DMARC and list quality
SPF alone does not protect the address your recipients see. Sign your mail with DKIM, then publish a policy with the DMARC generator; the three work together, as explained in SPF, DKIM and DMARC explained. Authentication proves the mail is yours. Mailbox providers also watch how much of it bounces, so verify your list before a campaign to keep invalid addresses out of it.