📋 SPF Records Guide

SPF Records: The Complete Guide
With Error Fixes & Flattening

Understand every SPF mechanism and qualifier, fix the most common SPF errors (PermError, SoftFail, too many DNS lookups), and build a bulletproof SPF record for cold email.

📅 Updated June 2026
⏱ 10 min read
👤 Priya Mehta, Technical Lead
What Is an SPF Record?

SPF (Sender Policy Framework) is a DNS TXT record published on your domain that specifies which mail servers are authorized to send email on your behalf. When a receiving mail server gets an email claiming to be from you@yourdomain.com, it checks your DNS for an SPF record and verifies that the sending server's IP is on the approved list.

If the sending IP isn't in your SPF record, the receiving server can choose to reject the email, quarantine it, or flag it as suspicious depending on your SPF qualifier (~all vs -all) and their own policy settings.

💡
SPF checks the envelope-from (Return-Path), not the visible From address. This is why SPF alone doesn't prevent display name spoofing — you need DMARC for that. See our DKIM & DMARC guide for the full picture.
SPF Record Syntax — Every Mechanism Explained

An SPF record is a single DNS TXT record with the value starting with v=spf1. Here's a breakdown of every mechanism and qualifier you'll encounter:

MechanismWhat It DoesDNS LookupsCommon Use
v=spf1Declares this is an SPF v1 record. Always first.0Required — always present
ip4:1.2.3.4Authorizes a specific IPv4 address0Your dedicated sending IP
ip4:1.2.3.0/24Authorizes an IPv4 CIDR range0Your IP block
ip6:2001:db8::1Authorizes a specific IPv6 address0IPv6 sending servers
include:domain.comIncludes all IPs from another domain's SPF1+Third-party ESPs (TuruMail, SendGrid, etc.)
aAuthorizes the domain's A record IP(s)1Your web server also sends mail
mxAuthorizes all IPs in the domain's MX records1+Inbound mail server also sends
ptr:domain.comMatches reverse DNS to a domain (deprecated)ManyAvoid — causes PermErrors
exists:domain.comPasses if a DNS query returns any A record1Rarely used
redirect=domain.comDelegates entire SPF policy to another domain1Multi-domain management
allMatches any IP not matched above (catch-all)0Always the last mechanism

SPF Qualifiers — The +, ~, -, ? Prefixes

QualifierResultEffect on Failing EmailsWhen to Use
+all (default)PassPasses everything — including unauthorized IPsNever — defeats the purpose of SPF
~allSoftFailMarks as suspicious but usually deliversInitial setup and when switching ESPs
-allHardFailInstructs receiving servers to rejectWhen DMARC p=reject is live and confirmed
?allNeutralNo policy — treated like there's no SPFTesting only
Real-World SPF Record Examples

Here are SPF records for common cold email setups:

TuruMail Only (simplest)
DNS TXT
yourdomain.com TXT 3600 v=spf1 include:smtp.turumail.com ~all
TuruMail + Google Workspace
DNS TXT
yourdomain.com TXT 3600 v=spf1 include:smtp.turumail.com include:_spf.google.com ~all
TuruMail + Google Workspace + Dedicated IP
DNS TXT
yourdomain.com TXT 3600 v=spf1 ip4:203.0.113.42 include:smtp.turumail.com include:_spf.google.com ~all
Common SPF Errors & How to Fix Them
PermError
Too Many DNS Lookups
Your SPF record has more than 10 DNS lookups. Every include:, a, mx, and exists: counts.
→ Flatten your SPF: replace include: with raw ip4: addresses. Use a flattening tool or TuruMail's SPF optimizer.
PermError
Multiple SPF Records
Your domain has two or more TXT records starting with v=spf1. This is invalid — only one SPF record is allowed per domain.
→ Delete all but one SPF record. Merge all mechanisms into a single TXT record.
SoftFail
Sending IP Not Authorized
Your TuruMail sending IP isn't in your SPF record. You're using ~all so emails still deliver, but with a reputation hit.
→ Add include:smtp.turumail.com to your SPF record. Verify in TuruMail dashboard under Authentication.
SoftFail
SPF String Too Long
SPF TXT records have a 255-character string limit and a 512-byte DNS response limit (before EDNS).
→ Split long records into multiple strings within a single TXT record (most DNS providers handle this automatically).
None
No SPF Record Found
Your domain has no SPF TXT record at all. ISPs will treat all email from your domain as unauthenticated.
→ Add a TXT record with value: v=spf1 include:smtp.turumail.com ~all
HardFail
Legitimate Emails Blocked
You use -all but have a service sending email that isn't in your SPF. Those emails are being rejected.
→ Audit all sending sources (support tools, transactional services, CRMs) and add them before switching from ~all to -all.
Understanding the 10-Lookup Limit

The most misunderstood aspect of SPF is the 10 DNS lookup limit (defined in RFC 7208). Here's how a typical multi-ESP setup can quickly hit that limit:

📊 DNS Lookup Count — Typical Cold Email Stack
TuruMail include:
2
Google Workspace include:
3
Mailchimp include:
2
Salesforce include:
2
Zendesk include:
1
Total lookups: 10 — At the limit! Add one more = PermError
⚠️
How to fix: SPF flattening resolves all include: chains to their final IP addresses and replaces them with ip4: entries — which use 0 DNS lookups. The downside is that flattened records need to be updated whenever your ESP changes their IP ranges. TuruMail's automatic SPF monitoring alerts you when changes are needed.
SPF Record Builder

Select the services you send from and we'll generate your SPF record automatically:

🔧 Interactive SPF Builder
Generated SPF Record:
v=spf1 include:smtp.turumail.com ~all

Bulletproof Authentication, Zero Headaches

TuruMail guides your SPF, DKIM, and DMARC setup step by step — and monitors them 24/7 so you never get caught off guard.

Start Free Trial → Full Auth Guide →