Skip to content
← All articles

SPF Record Explained: Syntax and -all

Short answer. SPF (Sender Policy Framework) is a DNS TXT record that lists the servers allowed to send mail for your domain. It starts with v=spf1, contains mechanisms (include, a, mx, ip4) and ends with a qualifier — ~all (softfail) or -all (hardfail). A domain may have only one SPF record.

Why SPF matters

Without SPF, anyone can send mail claiming your domain in the sender address. SPF gives the recipient mail server a list of allowed IPs so it can verify whether the sending server is legitimate. It is the first line of defense against forgery and a key deliverability signal.

SPF record syntax

example.com. IN TXT "v=spf1 include:_spf.google.com ip4:203.0.113.10 ~all"

# Check:
dig txt example.com
# or shorter:
dig +short txt example.com

SPF mechanisms

  • v=spf1 — required version at the start.
  • include:domain — pulls in another provider's SPF (Google, Mailgun).
  • a — allows IPs from the domain's A record.
  • mx — allows IPs from the domain's MX records.
  • ip4 / ip6 — an explicit address or subnet.
  • all — the final mechanism, applied to everything else.

~all vs -all: the difference

QualifierNameAction on failWhen to use
-allhardfailReject the messageWhen you are sure every sender is listed
~allsoftfailAccept but mark suspiciousDuring setup and testing
?allneutralNo actionNearly useless, not recommended
+allpassAllow everyoneDangerous — opens the domain to forgery
Start with ~all and collect DMARC reports. Once you confirm every legitimate source passes SPF, switch to -all for strict protection.

Common mistakes

  1. Multiple SPF records — only one TXT with v=spf1 is allowed, otherwise it is a permerror.
  2. Exceeding the 10 DNS-lookup limit — too many includes. See how to fix.
  3. No final all — the record is incomplete and receivers interpret it differently.
  4. Accidental +all — effectively disables protection.
SPF checks the envelope domain (MAIL FROM), not the visible From header. So SPF alone does not stop spoofing — you need DKIM and DMARC on top.

How enterno.io helps with SPF

The /email-check tool parses your SPF record, shows every mechanism, counts DNS Lookup and highlights problems: duplicates, the lookup-limit overrun, a missing all. That is faster than reading the record by hand. MX-lookup shows which servers actually receive mail, so you do not forget them in SPF. enterno diagnoses — the TXT record in the zone is edited by the domain owner. Free: 48+ tools and a DNS check.

FAQ

Can I have two SPF records?

No. There must be exactly one TXT record with v=spf1. Combine multiple sources into one record using extra include mechanisms.

How do ~all and -all differ in practice?

With ~all a suspicious message is usually delivered to spam; with -all it is rejected at receipt. Strict -all is stronger against forgery but riskier if a sender is missing.

Do I need SPF if I have DKIM?

Yes. DMARC requires at least one of SPF or DKIM to pass with domain alignment. Best practice is to configure both.

Check your SPF: run /email-check and confirm the record is correct. See also the 10-lookup limit and DKIM setup.

Check your website right now

Check your site's DNS →
More articles: DNS
DNS
DNS Record Types: A, AAAA, MX, CNAME, TXT and More
10.03.2025 · 149 views
DNS
ERR_NAME_NOT_RESOLVED Fix
23.06.2026 · 21 views
DNS
DNS TTL Best Practices: Optimal Values for Different Records
15.04.2026 · 373 views
DNS
How to Choose the Perfect Domain Name: A Complete Guide
16.03.2026 · 182 views