Complete walkthrough for creating and fixing SPF records to improve email deliverability.
Published: 2026-01-21 | Updated: 2026-01-21 | Read time: 6 min
bash
macOS/Linux
dig TXT yourdomain.com | grep spf
Windows PowerShell
Resolve-DnsName -Name yourdomain.com -Type TXT | Select-String spf
`
What You Might See
| Status | Example | Meaning |
|--------|---------|---------|
| No record | (empty) | You need to create one |
| Valid | v=spf1 include:_spf.google.com -all | Good—check if complete |
| Broken | v=spf1 +all` | Dangerous—anyone can send as you |
dns
v=spf1 [mechanisms] [all]
`
Common Mechanisms
| Mechanism | Example | What It Does |
|-----------|---------|--------------|
| include: | include:_spf.google.com | Authorize another domain's SPF |
| ip4: | ip4:192.168.1.1 | Authorize a specific IPv4 address |
| ip6: | ip6:2001:db8::1 | Authorize a specific IPv6 address |
| a | a | Authorize your domain's A record IP |
| mx | mx | Authorize your MX servers |
The "all" Qualifier
This is the most important part—it defines what happens to unauthorized senders:
| Qualifier | Meaning | Recommendation |
|-----------|---------|----------------|
| -all | Hard fail—reject unauthorized | Best for security |
| ~all | Soft fail—mark as suspicious | Good for testing |
| ?all | Neutral—no opinion | Not recommended |
| +all` | Pass all—anyone can send | NEVER use this |
dns
v=spf1 include:_spf.google.com -all
`
Microsoft 365 Only
`dns
v=spf1 include:spf.protection.outlook.com -all
`
Multiple Services (Common Setup)
If you use Google Workspace + a marketing tool like SendGrid:
`dns
v=spf1 include:_spf.google.com include:sendgrid.net -all
`
Building Your Record
1. Start with v=spf1
2. Add include: for each email service you use
3. End with -all (or ~all while testing)
Common Include Values
| Service | Include Value |
|---------|---------------|
| Google Workspace | include:_spf.google.com |
| Microsoft 365 | include:spf.protection.outlook.com |
| SendGrid | include:sendgrid.net |
| Mailgun | include:mailgun.org |
| Amazon SES | include:amazonses.com |
| Mailchimp | include:servers.mcsv.net |
| HubSpot | include:spf.hubspot.com` |
@ (or leave blank for root domain)
- Type: TXT
- Value: Your SPF record
- TTL: 3600 (1 hour) or default
dns
v=spf1 include:_spf.google.com -all
v=spf1 include:sendgrid.net -all
`
✅ Correct (merged):
`dns
v=spf1 include:_spf.google.com include:sendgrid.net -all
`
DNS Lookup Limit
SPF has a limit of 10 DNS lookups. Each include: counts as 1+ lookups. If you exceed 10, SPF fails.
Check your lookup count:
include:_spf.google.com = 2 lookups
include:sendgrid.net = 1 lookup
Direct IPs ( ip4:`) = 0 lookups
spf=pass
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of you@yourdomain.com designates [IP] as permitted sender)
``
+all means "anyone can send as my domain"—completely defeats the purpose.
✅ Fix: Always use -all (hard fail) or ~all (soft fail).
v=spf1 inclde:_spf.google.com -all (typo in "include")
✅ Fix: Double-check syntax. Use MailRisk to validate.
v=spf1 ip4:192.0.2.1 include:_spf.google.com -all
p=none and a reporting address
2. Wait 2-4 weeks to collect reports
3. Reports show all IPs sending as your domain
4. Add legitimate services to SPF
~all (soft fail) while testing-all (hard fail) once verified+all or ?all