Email marketing

What Is an SPF Record? How It Works and How To Set It Up

SPF record cover with three mail servers, pass and fail symbols, and an envelope
Denys Romanov
Denys Romanov
Updated: 25 July, 2026 / 1594 / 00 min

Key takeaways

  • SPF record is a DNS TXT policy that authorizes systems to send email for a domain.
  • SPF checks the SMTP envelope sender, not the visible From address directly.
  • DMARC aligns SPF or DKIM domains with the visible From domain.
  • An SPF record reduces domain spoofing and supports deliverability.
  • A valid SPF record helps protect domain reputation.
  • SPF evaluates the transmission path, not the message body.
  • SPF result is evidence, not a delivery command.
  • SPF record syntax includes various elements like ip4, ip6, a, mx, include, exists, all, redirect, exp.

An SPF record is a DNS TXT policy that tells receiving mail servers which systems may send email for a domain. SPF checks the SMTP envelope sender, usually shown as the Return-Path, or the HELO identity β€” not the visible From address by itself. This guide explains how SPF works, how to publish one safely, and how to diagnose common failures.

What is an SPF record?

SPF, or Sender Policy Framework, is an email-authentication standard defined in RFC 7208. A domain owner publishes a TXT record containing rules that authorize IP addresses and sending services. When a message arrives, the receiving server compares the connecting IP with the SPF policy for the SMTP MAIL FROM domain. If MAIL FROM is empty, the receiver can evaluate the HELO domain instead.

This distinction matters: SPF does not directly authenticate the address readers see in the From field. DMARC connects an authenticated SPF or DKIM domain to the visible From domain through alignment. Use all three controls together for stronger protection.

pic

Why use an SPF record for email?

A correct SPF policy gives mailbox providers a reliable way to identify infrastructure that is allowed to use your envelope-sender domain. It supports security and deliverability, but it does not guarantee Inbox placement.

Reduce domain spoofing

Unauthorized systems cannot produce an SPF Pass for a protected envelope-sender domain unless they match its published policy. With DMARC alignment, this also helps protect the domain displayed to recipients.

Support deliverability

Mailbox providers combine SPF with DKIM, DMARC, reputation, content, and local policy. A valid SPF record removes one common authentication problem, but a Pass is only one signal and a Fail does not prescribe one universal delivery action.

Protect domain reputation

Clearly documenting legitimate senders makes it easier to identify configuration drift and unauthorized activity. It also reduces the risk that missing authentication will contribute to filtering or a DNS blacklist problem.

How SPF works

  1. The sending system opens an SMTP connection.
  2. The receiving server identifies the MAIL FROM/Return-Path domain. If it is empty, it can use HELO.
  3. The receiver retrieves that domain’s SPF TXT policy.
  4. It evaluates mechanisms from left to right against the connecting IP address.
  5. The evaluation returns Pass, Fail, Softfail, Neutral, None, TempError, or PermError.
  6. The receiver combines this result with DKIM, DMARC, reputation, and its own filtering policy.

SPF evaluates the transmission path, not the message body. Forwarding can therefore break SPF because the forwarder’s IP may not be authorized by the original domain. Sender Rewriting Scheme (SRS) can help a forwarding service use a new aligned envelope sender.

SPF filtering in action

An SPF result is evidence, not a delivery command. For example, ~all produces Softfail when no previous mechanism matches; it does not force every receiver to put the message in spam. Likewise, SPF Pass does not guarantee Inbox delivery.

SPF record syntax explained

A simple Selzy-oriented policy can look like this:

v=spf1 include:spf.selzy.com ~all

If the domain already sends through another provider, combine all authorized services into one policy. Do not publish a second v=spf1 record.

Element Purpose Practical note
v=spf1 Declares SPF version 1 Must begin the policy.
ip4 / ip6 Authorizes an IP address or network Does not require an extra DNS lookup.
a Authorizes addresses returned by an A/AAAA lookup Use only when those hosts really send mail.
mx Authorizes addresses of the domain’s MX hosts Receiving mail and sending mail are often different.
include Evaluates another domain’s SPF policy Use the exact value supplied by the service.
exists Matches when a constructed domain resolves Advanced and easy to misuse.
all Always matches Normally appears last.
redirect Uses another policy when no mechanism matches It is a modifier, not the same as include.
exp Provides an explanation string for Fail Rarely needed.

Qualifiers define the result when a mechanism matches: + Pass (the default), - Fail, ~ Softfail, and ? Neutral. Avoid +all, which authorizes every sender. The ptr mechanism is deprecated and should not be used.

Rules and limits that commonly break SPF

  • Publish only one SPF policy per domain.
  • Merge every legitimate sender into that record.
  • Keep DNS-query-causing terms within the RFC processing limit of 10. Nested include chains count too.
  • Too many lookups or malformed terms can produce PermError.
  • Temporary DNS failures can produce TempError.
  • Avoid unnecessary a, mx, and exists chains.
  • Review the record whenever you add or remove a sending service.

How to add an SPF record

1. Inventory the Return-Path and every sender

List all platforms that send on behalf of your domain: your mailbox provider, Selzy, transactional systems, help desk, CRM, invoicing tools, and any custom servers. Send a real test message from each service and inspect the Return-Path and Authentication-Results headers. The Return-Path may differ from the visible From address.

Return-Path header in the email

2. Get the current Selzy settings

In Selzy, open Account β†’ Settings β†’ Domain Authentication, select Create, enter the domain, and choose Obtain Settings. Copy the exact DNS values shown in the account. Current Selzy documentation uses include:spf.selzy.com, but the account-generated settings are the final source of truth.

Selzy ESP dashboard

Open the Domain Authentication section and create a domain entry.

Domain authentication tab in Selzy

Enter the domain without a page path and obtain its authentication settings.

DKIM and SPF settings in Selzy

Selzy will show the DNS records that must be published. If an SPF policy already exists, add Selzy’s include to that policy instead of creating another SPF record.

Creation of SPF record in Selzy

3. Publish one TXT policy in DNS

Open your DNS provider and add or edit the TXT record for the sending domain. Provider labels vary, but the fields usually mean:

  • Type: TXT.
  • Host/Name: @, blank, or the domain, depending on the provider.
  • Value: the complete policy beginning with v=spf1.
  • TTL: the provider default is normally acceptable.

Some interfaces append the domain automatically, so confirm the final DNS name before saving.

Dreamhost control panel

Create or edit the TXT record in the DNS zone. Never split authorized providers into multiple v=spf1 records.

Creation a TXT record in DNS

Allow time for DNS caches to refresh. Changes are often visible quickly but can take longer depending on the previous TTL. Then return to Selzy and verify domain authentication.

The domain status in Selzy with a set-up authentication

How to check an SPF record

Use more than one verification method:

  1. DNS lookup: confirm that the expected TXT policy is publicly visible and that only one SPF record exists.
  2. SPF checker: review syntax, expanded includes, and DNS lookup count with a tool such as MXToolbox.
  3. Real-message test: send through each authorized platform and inspect Authentication-Results and Received-SPF. Confirm which domain was evaluated and whether it aligns with the visible From domain for DMARC.
Checking SPF record in MxToolbox

A DNS lookup should return the policy you intended to publish. If nothing appears, check the host name, record type, and DNS delegation.

Check results in MxToolbox

A syntax checker can identify malformed terms, but a syntactically valid record may still omit a legitimate sender or exceed the lookup limit after includes are expanded.

SPF Syntax Validator check process

Review warnings as well as the pass/fail indicator. Test a real message from every sending service.

pic

If a tool reports an error, fix the underlying policy rather than adding a second SPF record.

pic

Common SPF errors and fixes

Symptom Likely cause Safe next action
No SPF record Wrong host, unpublished TXT value, or DNS propagation Check the authoritative DNS zone and query the exact domain.
Multiple SPF records Each provider was added separately Merge all mechanisms into one v=spf1 policy.
Fail for a legitimate service The connecting IP or provider include is missing Use the provider’s official include value and retest.
PermError Invalid syntax, multiple policies, or too many DNS lookups Validate the expanded policy and simplify it.
TempError Temporary DNS lookup failure Check DNS health and retry before changing the policy.
SPF fails after forwarding The forwarder’s IP is not authorized by the original domain Use DKIM/DMARC; forwarding services can implement SRS.
SPF passes but DMARC fails The SPF-authenticated domain is not aligned with the visible From domain Configure a custom Return-Path or rely on aligned DKIM.

SPF implementation checklist

  • Inventory every service that sends email for the domain.
  • Confirm the MAIL FROM/Return-Path used by each service.
  • Collect official SPF include values from providers.
  • Merge them into one policy.
  • Validate syntax and the 10-lookup processing limit.
  • Publish the TXT record and wait for DNS caches to refresh.
  • Test real messages from every sender.
  • Enable DKIM and DMARC and check alignment.
  • Review SPF whenever sending infrastructure changes.

SPF is most useful when it is accurate, compact, and maintained. Treat it as one part of an authentication system β€” not as a guarantee of delivery or a complete defense against phishing.

FAQ

What is an SPF record?

An SPF record is a DNS TXT policy that tells receiving mail servers which systems may send email for a domain. It is part of the Sender Policy Framework standard and is checked against the SMTP envelope sender, usually the Return-Path, or the HELO identity when needed.

How do I create an SPF record?

Publish a TXT record that lists the IP addresses and sending services authorized to send for your domain. A simple example is `v=spf1 include:spf.selzy.com ~all`, and if you send through multiple providers, you should combine all authorized senders into one policy.

Can a domain have more than one SPF record?

No. SPF is published as a single TXT policy for a domain, so you should combine all authorized senders into one record rather than creating separate SPF records.

What is the SPF 10-DNS-lookup limit?

SPF evaluation is based on mechanisms in the TXT policy, and each lookup adds processing during validation. To keep the policy safe and reliable, avoid overly complex records that depend on too many DNS lookups, since SPF can return PermError when evaluation cannot be completed properly.

Why can forwarding cause SPF failures?

SPF checks the connecting IP against the original sender's envelope-sender domain, so a forwarded message may come from the forwarder's server, not the authorized source. If that forwarder is not listed in the SPF policy, the check can fail; Sender Rewriting Scheme (SRS) can help by using a new aligned envelope sender.

Does SPF protect the visible From address?

Not by itself. SPF validates the SMTP envelope sender, not the address users see in the From field, so DMARC is needed to connect authenticated SPF or DKIM results to the visible From domain through alignment.

How do SPF, DKIM, and DMARC work together?

SPF validates the sending path, DKIM validates the message, and DMARC ties an authenticated SPF or DKIM domain to the visible From domain through alignment. Used together, they provide stronger protection against spoofing and help mailbox providers make filtering decisions.

Updated: 25 July, 2026

In this article
What is an SPF record? Why use an SPF record for email? How SPF works SPF record syntax explained How to add an SPF record How to check an SPF record Common SPF errors and fixes SPF implementation checklist
Denys Romanov

Written by Denys Romanov

QA Engineer and email infrastructure specialist at UniOne, an API-powered solution for automated emails. Denys combines a strong technical background with a knack for making complex topics easy to understand. His articles cover everything from email best practices and deliverability to broader email and digital marketing strategies β€” always with a focus on clear, practical takeaways. Whether you're on the technical side or the marketing side, his writing is aimed at helping you get better results from your campaigns.