How to use the SPF generator
- Tick every service that sends mail with your domain in the envelope sender: your mailbox provider, your transactional email API, your marketing tool, your helpdesk.
- Add any servers of your own as
ip4:orip6:ranges. - Choose how to treat everything else.
~allis the usual choice alongside DMARC. - Click Count real DNS lookups. The generator resolves the draft record live, without publishing it, and shows the full include tree.
- Publish the record as a TXT record at the root of the domain (
@in most DNS panels), replacing any existingv=spf1record.
Examples
Google Workspace plus a transactional provider:
v=spf1 include:_spf.google.com include:sendgrid.net ~all
A single office server and Microsoft 365:
v=spf1 ip4:203.0.113.25 include:spf.protection.outlook.com -all
A domain that never sends mail:
v=spf1 -all
Keeping under the lookup limit
- Remove includes for services you have stopped using. They still cost lookups.
- Use
ip4:/ip6:for your own servers. They are free. - Send marketing or bulk mail from a subdomain (
news.example.com) with its own SPF record. - Check the record again from time to time. Providers change their own records, and your total can grow without you editing anything.
Many services use their own envelope domain
Some email services send with their own Return-Path domain by default. Then SPF is checked against their domain, not yours, and adding their include to your record changes nothing. It only counts once you configure the provider's custom return-path or bounce domain on a subdomain of yours. That subdomain gets its own SPF record, usually a CNAME or TXT record the provider gives you.
Frequently asked questions
No. A domain must have exactly one v=spf1 record. Add the new service's include to your existing record instead.
Each include can pull in more includes. The record may look like it has four includes but cost nine lookups. Past ten, receivers return permerror and SPF fails for every message.
Only if the servers in your A or MX records actually send mail as the domain. With a hosted mailbox provider, the provider's include already covers outbound mail, and a and mx just waste lookups.
In their domain authentication or SPF setup guide. The common ones are listed here. If a provider gives you IP ranges instead, add them as ip4 or ip6.