SPF generator
Tick the servers and services that send email on your behalf: the SPF record is built as you go, with a count of DNS lookups and the mistakes to avoid.
Record to publish
- Name
@- Type
TXT- TTL
3600
v=spf1 mx ~all
Create this TXT record in your domain's DNS zone, then run the test to check that it is published.
Writing a good SPF record
List every sender
Before writing SPF, list everything that sends email with your domain: the mailbox provider (Google Workspace, Microsoft 365…), the website (forms, shop), the newsletter tool, the invoicing software or the CRM. A forgotten sender will see its messages fail the SPF check.
mx, a, ip4 or include?
mx allows the servers that receive your mail, a the domain's address, ip4 and ip6 specific addresses with no DNS lookup. include delegates to a service that publishes its own server list: it is the right choice for sending services, because their addresses change.
Stay under 10 DNS lookups
Each mx, a and include costs a DNS lookup, and service includes often contain more. Beyond 10 the record is invalid. Remove useless mechanisms (a or mx if those servers send nothing) and prefer ip4 for your own servers.
Publish, then check
Replace the old SPF record rather than adding a second one: two v=spf1 records make SPF invalid. Once the zone is updated, run the SPF test to see the real lookup total, then complete the protection with DKIM and DMARC.
Frequently asked questions
Where do I publish the SPF record?
In the domain's DNS zone, as a TXT record on the domain name itself (@ or an empty name depending on the host). A domain must have only one SPF record: merge them if you have several.
Should I choose ~all or -all?
~all (soft fail) is a safe start: a forgotten sender will have its email flagged rather than rejected. Once all your services are listed, and with DMARC in place, -all gives the strongest protection.
Why the 10 DNS lookup limit?
The SPF standard limits to 10 the mechanisms that trigger a DNS lookup (include, a, mx, exists, redirect). Beyond that the result is a permanent error and SPF protects nothing. Service includes often add lookups of their own.
Can I have two SPF records?
No: with two v=spf1 records, receivers return an error and SPF no longer applies. Put all mechanisms in a single record, which is what this generator does.
Is SPF enough to protect my domain?
No. SPF only checks the sending server, not the address shown to the recipient. It must be completed by a DKIM signature and a DMARC policy, which ties both to the From address.