Sender policy framework (SPF) is an email authentication standard that helps prevent email spoofing.

What Is the Sender Policy Framework?
Sender policy framework is an email authentication protocol that uses DNS records to indicate which mail servers are allowed to send email for a specific domain. The domain owner publishes an SPF record in the domainโs DNS zone as a specially formatted TXT entry. This record lists authorized IP addresses or hostnames and includes rules for how receiving mail servers should evaluate messages that claim to come from that domain.
When an email is received, the recipientโs mail server checks the envelope sender domain in the SMTP transaction and looks up its SPF record in DNS. It then compares the sending serverโs IP address to the authorized sources defined in that record and returns a result such as โpass,โ โfail,โ โsoftfail,โ or โneutral.โ Based on this outcome, the receiving system accepts, flags, or rejects the message.
By verifying that emails originate from legitimate infrastructure, SPF helps prevent domain spoofing, supports more accurate spam filtering, and strengthens overall email security when used alongside other mechanisms like DKIM and DMARC.
How Does Sender Policy Framework Work?
Sender policy framework enables receiving mail servers to verify whether an email was sent from a server authorized by the domain owner. It relies on DNS records and checks performed during the SMTP handshake, before the message is fully accepted. Here is how the process unfolds step by step:
- Domain owner publishes an SPF record. The process starts when the domain owner creates an SPF policy and publishes it as a TXT record in DNS. This record lists the IP addresses or hostnames of mail servers that are allowed to send email for that domain. This step establishes the official โsource of truthโ for legitimate senders.
- Senderโs mail server connects to recipientโs server. When someone sends an email, the sending mail server opens an SMTP connection to the recipientโs mail server. During this initial handshake, the sending server presents the envelope sender domain (the domain in the MAIL FROM command). This information is what the recipient uses to determine which SPF record to check.
- Recipientโs server looks up the SPF record in DNS. The receiving server extracts the envelope sender domain and performs a DNS query to retrieve that domainโs SPF record. This lookup fetches the published TXT entry that contains the SPF policy. At this point, the recipient has all the rules it needs to evaluate the sender.
- SPF policy is evaluated against the senderโs IP. The recipientโs server compares the IP address of the sending mail server to the list of allowed IPs, hostnames, or mechanisms defined in the SPF record. It processes the record from left to right, checking mechanisms such as ip4, ip6, a, mx, or include. This evaluation determines whether the sender matches any authorized source.
- An SPF result is generated. Based on the evaluation, the receiving server produces an SPF result such as โpass,โ โfail,โ โsoftfail,โ โneutral,โ โtemperror,โ or โpermerror.โ A โpassโ indicates the sender is authorized, while a โfailโ means the sender is explicitly not permitted. Other results indicate uncertain or temporary conditions.
- The recipient applies local email policies. The mail system then uses the SPF result to decide what to do with the message. It might accept it normally, place it in spam, add a warning header, or reject it outright if the result is โfailโ and local policy is strict. This step turns the SPF evaluation into a practical action that helps block spoofed or suspicious emails.
- SPF result is recorded for downstream checks. Finally, the SPF outcome is usually added to the emailโs headers so that downstream filters, security gateways, and the userโs mailbox provider can see how the SPF check went. This information can be combined with other signals, such as DKIM and DMARC results, to make more accurate spam and phishing decisions.
What Is Policy Sender Framework Example?

An example of sender policy framework is a simple SPF record published for a domain that uses specific mail servers to send email. For instance, suppose the domain example.com sends email only from two IPv4 addresses and from its own MX servers. The domain owner would add this TXT record in DNS:
v=spf1 ip4:203.0.113.10 ip4:203.0.113.20 mx ~all
In this example, v=spf1 declares the SPF version, ip4:203.0.113.10 and ip4:203.0.113.20 authorize those IP addresses as valid senders, mx allows any server listed as an MX record for example.com, and ~all marks all other sources as not authorized (soft fail). When a recipientโs mail server gets an email claiming to be from example.com, it checks this SPF record and verifies whether the sending IP matches one of the authorized entries before deciding to accept, flag, or reject the message.
Who Should Use Sender Policy Framework?
Sender policy framework is useful for any organization that sends email from its own domain and wants to protect its reputation and users from spoofing. It is especially important when multiple services send email on behalf of the same domain (e.g., marketing platforms, ticketing systems, CRM tools). Letโs discuss who benefits from SPF:
- Businesses of all sizes. Any company that sends transactional or marketing emails should use SPF to prevent attackers from forging its domain. This helps keep invoices, password reset emails, and notifications from being impersonated and reduces the chance of customers receiving phishing messages that appear to come from the business.
- Online services and SaaS providers. Web apps, SaaS platforms, and online marketplaces rely heavily on automated emails such as account confirmations, alerts, and receipts. Implementing SPF ensures these messages are more likely to pass spam checks and reach user inboxes, while making it harder for attackers to abuse the brand in phishing campaigns.
- Email service providers and marketing platforms. ESPs and bulk email platforms that send on behalf of clients need correctly configured SPF (often via custom sending domains or includes) to achieve good deliverability. Proper SPF alignment shows receiving servers that the platform is an authorized sender, improving inbox placement for all campaigns.
- Organizations with multiple third-party senders. Organizations that use several external systems to send email (CRM, helpdesk, HR tools, monitoring systems, etc.) benefit from SPF as a central policy. By listing all authorized sources in a single record, they maintain control over who can send using their domain and can quickly revoke access by updating the SPF entry.
- Public sector, financial, and high-trust brands. Government agencies, banks, healthcare providers, and other high-trust entities are frequent targets for phishing. SPF, combined with DKIM and DMARC, significantly raises the bar for attackers trying to spoof these domains and helps protect citizens, customers, and patients from fraudulent messages.
How to Set Up Sender Policy Framework?
Setting up sender policy framework involves publishing a DNS record that tells the world which mail servers are allowed to send email for your domain. The process is straightforward but must be done carefully to ensure all legitimate senders are included:
- Identify all servers and services that send email for your domain. Start by listing every system that sends email using your domain name: your main mail server, marketing tools, CRM systems, cloud services, or helpdesk platforms. This ensures you donโt accidentally block legitimate messages.
- Generate an SPF policy with the authorized servers. Create an SPF rule that includes all your sending sources. You can specify them by IP address, domain name, or include records from third-party providers. The SPF rule will start with v=spf1 and end with a qualifier like -all or ~all to define how unauthorized senders are handled.
- Add the SPF record to your DNS settings. Log in to your DNS providerโs management portal and create a new TXT record for your domain. Paste the SPF rule you generatedโfor example:
v=spf1 mx include:mailprovider.com -all
Publishing this record makes your policy publicly visible to mail receivers. - Wait for DNS propagation. It may take minutes to hours for the updated DNS record to spread worldwide. During this time, some mail servers may still rely on the old configuration.
- Test and validate the SPF configuration. Use online SPF validation tools or your email security platform to confirm the record is correctly published and covers all authorized senders. Testing ensures that legitimate messages pass SPF and that spoofed messages are rejected or flagged.
- Maintain and update when senders change. Whenever you add or remove email services, update your SPF record accordingly. Regular maintenance ensures ongoing protection and consistent email deliverability.
The Advantages and Limitations of SPF
Sender policy framework offers clear benefits for email security and deliverability, but it is not a complete solution on its own. Understanding both its advantages and its limitations helps domain owners deploy SPF effectively, avoid misconfigurations that block legitimate mail, and decide when to combine it with other technologies like DKIM and DMARC for stronger protection.
What Are the Benefits of Sender Policy Framework?
SPF improves email security by making it harder for attackers to impersonate your domain and by giving receiving servers clearer signals about which messages are legitimate. Its benefits are strongest when SPF is configured correctly and kept up to date:
- Reduces email spoofing and domain abuse. By explicitly listing which servers can send mail for your domain, SPF helps block emails sent from unauthorized IP addresses. This reduces successful spoofing attempts where attackers pretend to send from your domain.
- Protects brand reputation and user trust. When fewer fake emails appear to come from your domain, recipients are less likely to associate your brand with phishing or spam. This protection helps maintain trust in important messages such as invoices, alerts, and password reset emails.
- Improves spam and phishing filtering. SPF results give receiving mail servers a strong signal they can use in their spam filters. Messages that pass SPF are more likely to be treated as legitimate, while those that fail can be flagged or rejected, strengthening overall anti-spam defenses.
- Supports better email deliverability. Correct SPF records make it easier for legitimate email to reach inboxes instead of spam folders. Many providers check SPF as part of their authentication process, so a valid configuration improves deliverability for newsletters, transactional emails, and notifications.
- Centralized control over authorized senders. SPF provides a single place in DNS where you specify all systems allowed to send on behalf of your domain. This central control simplifies management, especially when you use multiple third-party services, and allows you to revoke access by updating one record.
- Works well with DKIM and DMARC. SPF is designed to complement other authentication methods rather than replace them. When combined with DKIM and enforced through DMARC, SPF contributes to a layered defense that makes phishing and domain forgery significantly more difficult.
What Are the Limitations of Sender Policy Framework?
SPF is valuable but has important limitations that domain owners need to understand. On its own, it cannot fully prevent phishing or spoofing and must be managed carefully to avoid blocking legitimate messages. Here are the main limitations:
- Does not protect the visible โFromโ address by itself. SPF validates the envelope sender used at the SMTP level, not necessarily the address users see in the โFromโ field. Attackers can align a passing SPF domain with a different, misleading visible address, which means SPF alone cannot stop all phishing attempts.
- Breaks easily with email forwarding. When an email is forwarded, the forwarding serverโs IP address is usually not listed in the original senderโs SPF record. As a result, SPF checks at the final recipient may fail even though the message is legitimate. This makes SPF less reliable in environments with heavy forwarding or mailing lists.
- DNS lookup and record length limitations. SPF evaluation is limited to 10 DNS lookups, and overly complex records can hit this limit or become hard to manage. Long or nested include chains, many IP ranges, and frequent changes increase the risk of misconfiguration, leading to temporary errors or incorrect results.
- No protection of message content or integrity. SPF only validates the sending IP against the claimed domain. It does not sign or protect the email body or headers. An attacker using an authorized server, a compromised account, or an open relay could still send malicious content that passes SPF.
- Requires continuous maintenance as senders change. Every time you add, change, or remove email providers and sending infrastructure, your SPF record must be updated. If this maintenance is neglected, legitimate emails from new services may fail SPF checks and be delivered to spam or rejected.
- Limited value without DKIM and DMARC. On its own, SPF provides only partial authentication. Without DKIM to verify content and DMARC to specify how failures should be handled and to align visible addresses, SPFโs ability to stop sophisticated phishing campaigns is limited. It works best as one layer in a broader email authentication strategy.
Sender Policy Framework FAQ
Here are the answers to the most commonly asked questions about sender policy framework.
Why Did SPF Cause My Mail to Be Rejected?
If your mail was rejected due to SPF, it means the receiving mail server determined that the IP address or service sending the message was not authorized in your domainโs SPF record. This often happens when a new email service isnโt added to the SPF record, when forwarding breaks SPF validation, or when the policy ends with a strict qualifier such as -all that instructs recipients to reject unauthorized senders. Updating your SPF record to include all legitimate sending systems and checking for configuration issues typically resolves the problem.
Does SPF Stop All Phishing?
No, SPF does not stop all phishing. While it helps prevent attackers from sending emails that appear to come from your domain by blocking unauthorized mail servers, it only verifies the envelope sender and does not protect the visible โFromโ address or the content of the message. Attackers can still use look-alike domains, compromised accounts, or misleading display names to carry out phishing attacks. For stronger protection, SPF should be combined with DKIM and DMARC to enforce alignment and detection across both sender identity and message integrity.
What Is the Difference Between SPF, DKIM, and DMARC?
Here is a clear and concise comparison table that explains the difference between SPF, DKIM, and DMARC:
| Feature | SPF | DKIM | DMARC |
| Primary purpose | Verifies whether the sending mail server is authorized to send email for the domain. | Verifies the integrity of the email content through a cryptographic signature. | Enforces alignment between SPF/DKIM and the visible โFromโ address and tells receivers how to handle failures. |
| How it works | Checks the senderโs IP against the domainโs SPF DNS record. | Checks a digital signature in the email header against a public key in DNS. | Evaluates SPF and/or DKIM results and applies the domainโs policy (none, quarantine, reject). |
| Protects against | Spoofing of envelope sender address. | Tampering with email contents and forging sender identity. | Both spoofing and phishing by enforcing alignment and reporting on authentication failures. |
| What it secures | SMTP envelope sender domain. | Message headers and body integrity. | Visible โFromโ domain authenticity and policy control. |
| Required DNS record | TXT record with approved sending servers. | TXT record with public key. | TXT record with alignment rules and reporting options. |
| Effect on deliverability | Improves acceptance of legitimate mail if valid. | Strongly improves trust and inbox placement. | Provides the most control, reduces spoofing, and improves email reputation overall. |