SPF record generator
Build an SPF record from your mail providers’ include domains, your own IP addresses and an all policy. Checks the syntax and warns about the DNS lookup limit.
Who sends mail for the domain
One per line. Each provider documents the domain to include; copy it from their setup guide.
IPv4 or IPv6, single addresses or networks. One per line.
Your SPF record
v=spf1 ~all
Publish it as a TXT record on the domain itself (host @ or the bare domain name). A domain may have only one SPF record: if one exists, replace it, do not add a second.
Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.
How to use the SPF record generator
- List the include domain of each service that sends mail as your domain.
- Add the IP addresses of your own mail servers, if you have any.
- Choose what happens to everyone else: ~all to start, -all when the list is complete.
- Copy the record and publish it as a TXT record on the domain, replacing any existing SPF record.
- Run the SPF record checker to confirm the lookup count.
About this tool
An SPF record tells receiving mail servers which hosts may send mail for your domain. You publish it as one TXT record on the domain: v=spf1, then a mechanism for each sender, then an all mechanism for everyone else. This generator writes that record from the include domains of your mail providers and your own sending addresses.
Every provider that sends mail as your domain, such as your mailbox host, your newsletter tool or your support desk, documents an include domain. Copy it from their setup guide rather than guessing, because a wrong include either fails or authorizes someone else’s senders. Your own servers go in as ip4 and ip6 addresses, which cost no DNS lookup. The mx and a options allow whatever your MX and address records point to.
Keep an eye on the count. Receivers allow 10 DNS lookups in total, and each include brings its own nested lookups, so five or six providers can exceed it. Start with ~all, watch your DMARC reports, and tighten to -all once every legitimate sender is listed. A domain that sends no mail at all should publish v=spf1 -all.
Sources
Questions
Add a TXT record on your domain whose value starts with v=spf1, lists your senders with include, ip4 and ip6, and ends with ~all or -all. The host is the domain itself, shown as @ in many DNS editors.
v=spf1 -all. It says no server is allowed to send mail for the domain, so receivers can reject anything that claims to come from it. Pair it with a DMARC record with p=reject.
In the provider’s documentation for setting up SPF or email authentication. It is a host name such as _spf.example.net. Use exactly what they publish, since providers change the addresses behind it without notice.
A single string inside a TXT record holds at most 255 characters. A longer record must be split into several quoted strings in the same record, which receivers join together. RFC 7208 also advises keeping the whole record small enough for one DNS packet.