Email DNS2 min read

How to Check an SPF Record

By DNSRadar

SPF is published as a TXT record and tells receiving mail systems which servers are allowed to send for a domain. A small DNS mistake can make legitimate messages fail authentication or make the policy ineffective.

Find the SPF TXT record

SPF usually lives at the domain used in the SMTP envelope-from address. Look for a TXT value beginning with v=spf1.

SPF lookupdig
dig example.com TXT +short
dig @1.1.1.1 example.com TXT +short

Check for duplicate SPF policies

A domain should publish exactly one SPF policy. If two TXT records both start with v=spf1, SPF evaluation returns a permanent error.

Duplicate SPF checkdig
dig example.com TXT +short | grep 'v=spf1'

Understand the ending mechanism

  • -all asks receivers to fail mail that does not match authorised senders.
  • ~all is a softfail and is often used during a transition.
  • ?all is neutral and rarely adds useful protection.
  • +all allows everything and is usually a security mistake.

Common SPF mistakes

Adding every provider without review

Too many include mechanisms can exceed the SPF ten-lookup limit.

Checking only the visible From domain

SPF validates the envelope-from domain, which may differ from the visible sender.

Publishing two SPF records

Merge authorised senders into one v=spf1 policy.

Ignoring DKIM and DMARC

SPF alone does not fully protect domain alignment or spoofing.

Worked example: two policies are not a safe migration

Suppose example.com publishes the two TXT records below while moving email providers. Both start with v=spf1. A receiver must not combine them into one policy: multiple SPF records at the same owner name produce a permanent SPF error. Other TXT records used for domain ownership can coexist because they are not SPF policies.

The example addresses are reserved for documentation. If both sending systems are legitimate, design one policy that authorizes the required senders, validate it and publish a single SPF record. Do not copy the sample as your production policy. Check all sources of outbound mail, including support software and transactional mail, before removing the previous provider.

A TXT lookup verifies publication, not a complete SPF evaluation. SPF checks the actual sending IP and the SMTP envelope domain, and includes a limit of ten DNS-query-causing terms during evaluation. An include chain can exceed that limit even if the root record looks short. Use a controlled test message and inspect Authentication-Results to confirm the evaluated identity and result.

Illustrative invalid configurationdig
example.com. 300 IN TXT "v=spf1 ip4:192.0.2.10 -all"
example.com. 300 IN TXT "v=spf1 ip4:192.0.2.20 -all"

Sources and editorial approach

Technical documentation by DNSRadar. Examples using example.com and documentation addresses are illustrative; adapt commands to your zone and compare authoritative answers before changing production.

How we measure and the tool's limitations · Report a correction

Related DNS guides