SPF record

Sender Policy Framework record

An SPF record is a line of text in your domain's DNS that lists which mail servers are allowed to send email using your domain name.

Checked 27/11/2026 against 3 sources. Next review 27/05/2027.

An SPF record is a DNS text entry that names the servers allowed to send email for your domain. A receiving mail server reads it and checks whether the sending server is on the list [1]. What happens to mail from a server that is not on the list is up to the receiver. SPF is one of three email checks, alongside DKIM and DMARC. Gmail asks every sender to set up SPF or DKIM [2], and Yahoo asks the same as a minimum [3].

What does an SPF record look like?

An SPF record is a single TXT record that starts with v=spf1. The rest is a list of terms, read left to right. The standard's own example allows the servers in the domain's MX records and the addresses around one named host, then fails everything else [1].

example.com.  TXT  "v=spf1 +mx a:colo.example.com/28 -all"

Here mx allows the servers named in your MX record, a: allows a host's address, and -all says every other sender fails [1]. Most small businesses use an include: term instead, which pulls in the list of the service that sends their mail.

A shop that sends from two places

Say example.com sends staff email through one provider and order confirmations through an online shop platform. The record could read: v=spf1 include:_spf.mailprovider.example include:_spf.shopplatform.example ~all. Each provider publishes its own include value, so copy it from their setup page, not from this example.

Why does my SPF record fail with too many lookups?

The standard caps the number of terms that cause a DNS query at 10. These terms are include, a, mx, ptr, exists and the redirect modifier. Go over 10 and the check returns a permanent error (permerror), which means the record could not be correctly interpreted [1]. The terms ip4, ip6 and all do not count [1].

Each include for a different mail service adds at least one lookup, and that service's own record can add more. A business that adds a newsletter tool, a CRM and a shop platform can pass 10 without noticing.

  • Remove services you no longer use.
  • Swap an a or mx term for fixed ip4 addresses where the address will not change.
  • Never publish two SPF records on one domain. More than one record also produces a permanent error [1]. Merge them into one.

What is the difference between -all and ~all?

The all term goes last and catches every sender not matched earlier. A minus sign before it makes those senders fail [1]. A tilde makes the result a soft fail. The standard puts a soft fail somewhere between fail and neutral: the domain is not willing to make a strong policy statement, and receivers should not reject the message on that result alone [1]. A cautious way to start is ~all while you find every service that sends for you, then move to -all.

Do I need SPF to send email to Gmail and Yahoo?

You need SPF or DKIM at a minimum. Google asks every sender to set up SPF or DKIM for the sending domain [2]. Senders of more than 5,000 messages a day to Gmail accounts must set up SPF, DKIM and DMARC [2]. Yahoo asks all senders for SPF or DKIM at a minimum, and bulk senders must implement both SPF and DKIM and publish a DMARC policy [3].

Sender typeWhat is askedSource
Any sender to GmailSPF or DKIM at a minimumGoogle [2]
More than 5,000 a day to GmailSPF, DKIM and DMARCGoogle [2]
Any sender to YahooSPF or DKIM at a minimumYahoo [3]
Bulk sender to YahooSPF and DKIM, plus DMARCYahoo [3]

SPF alone does not stop someone faking your visible From address. That is the job of DMARC, which asks that the domain that passed SPF or DKIM is the same as the domain in the From header [2].

Questions people ask

Is an SPF record the same as a TXT record?

An SPF record is stored as a TXT record. The TXT is the DNS record type, and the text inside it starts with v=spf1, which is what marks it as SPF [1]. A domain can have other TXT records beside it.

How many SPF records can a domain have?

One. If a receiver finds more than one SPF record on a domain, the check returns a permanent error [1]. Merge extra records into a single line with all your include terms.

Does SPF stop spam sent in my name?

Only partly. SPF checks the sending server against your list, but it does not by itself protect the From address people see. Google asks bulk senders to add DKIM and DMARC as well [2].

See also

  • DKIM DKIM is an email check where your mail server signs each message and publishes a public key in DNS, so the receiver can confirm the signature.
  • DMARC DMARC is a DNS record that tells mail servers what to do with email that fails your SPF and DKIM checks, and asks them to send you reports.
  • DNS DNS is the internet's address book: it turns a domain name like example.com into the number a computer needs to find your website or mail server.
  • MX record An MX record is a DNS entry that names the mail server that receives email sent to your domain.
  • Email deliverability Email deliverability is whether the email you send actually reaches the recipient's inbox instead of being blocked or sent to spam.

References

  1. RFC 7208: Sender Policy Framework (SPF) for Authorizing Use of Domains in Email, Version 1, IETF. Read 27/11/2026.SPF implementations MUST limit the total number of those terms to 10 during SPF evaluation, to avoid unreasonable load on the DNS.
  2. Email sender guidelines, Google Workspace Admin Help. Read 27/11/2026.Set up SPF or DKIM email authentication for your sending domains.
  3. Sender best practices, Yahoo Sender Hub. Read 27/11/2026.Implement SPF or DKIM at a minimum