Email Security

What Is SPF?

SPF (Sender Policy Framework) is an email authentication method that verifies the sending mail server is authorized to originate mail from the email sender's domain.

Alway Automate, Nothing To Manage

Always automated.

Nothing to manage.

Leave Training & Simulated Phishing to us.

SPF (Sender Policy Framework) is an email authentication method that verifies the sending mail server is authorized to originate mail from the email sender's domain. It uses DNS TXT records to list authorized IP addresses for sending emails from a domain, allowing receiving mail servers to prevent email spoofing. When an email arrives claiming to be from a particular domain, the receiving server performs a DNS lookup of the sender's domain SPF record and compares the sending server's IP address against the authorized list. If the IP matches, the email passes SPF verification; if not, it may be flagged or rejected based on the receiving server's policies.

How does SPF work?

SPF operates through a straightforward DNS-based verification process that validates sender authorization before email reaches recipient inboxes.

When a domain owner wants to implement SPF, they create an SPF record in their DNS settings as a TXT record. This record lists all IP addresses and mail servers authorized to send emails on behalf of the domain. The record includes specific mechanisms like "include," "a," "mx," "ptr," and "exists" that define authorized sources, along with modifiers that control how the record is processed.

When an email is sent claiming to be from the domain, the recipient's mail server initiates the verification process. The receiving server performs a DNS lookup to retrieve the sender's domain SPF record. It then evaluates the mechanisms and modifiers listed in the record from left to right, performing additional DNS lookups as needed to discover all authorized sources.

The receiving server compares the sending server's IP address against the authorized list in the SPF record. If the IP address matches one of the authorized sources, the email passes SPF verification. If the IP doesn't match, the email may be flagged as suspicious or rejected entirely, depending on the receiving server's policies and the SPF record's directives.

RFC 7208 imposes a critical limit on SPF processing: DNS lookups cannot exceed 10 per SPF check. This limitation exists to prevent Denial-of-Service attacks against DNS infrastructure. When SPF evaluation triggers more than 10 DNS lookups, the verification fails with a "PermError" status, and the email may be rejected regardless of whether the sender would have been authorized.

How does SPF differ from other email authentication methods?

Feature

SPF

DKIM

DMARC

Authentication method

DNS lookup validates sending IP

Cryptographic signature validates message content

Policy layer using SPF/DKIM results

What it validates

MAIL FROM address (envelope sender)

Message headers and body integrity

Alignment between authenticated domain and visible From header

Deployment complexity

Low (DNS record only)

Medium (requires key generation and management)

Medium (requires SPF/DKIM foundation plus policy)

Survives email forwarding

No (forwarding breaks SPF)

Yes (if content unchanged)

No (unless ARC implemented)

DNS lookups required

Up to 10 per check (hard limit)

1 per DKIM signature

1 for policy lookup

Protects against

IP-based spoofing

Content tampering, some spoofing

Header spoofing, provides enforcement

Ideal for

Organizations needing basic sender IP validation with simple DNS management

Organizations requiring message integrity verification and content authentication

Organizations needing comprehensive anti-spoofing protection with enforcement policies

Why does SPF matter?

SPF provides the foundation for email authentication by preventing attackers from easily spoofing a domain's email address. Without SPF, anyone can configure a mail server to send emails claiming to be from any domain, making phishing and spam trivial to execute at scale.

As of 2024, major email providers have made SPF a mandatory requirement. In February 2024, Google began requiring SPF or DKIM for all domains sending to Gmail accounts. Starting May 5, 2025, Microsoft will reject emails from senders failing authentication rules, which include SPF verification. These mandates reflect the industry's recognition that unauthenticated email poses unacceptable security risks.

Despite these requirements, adoption remains incomplete. According to DMARCChecker's 2024 analysis, 39% of the top 1 million domains lacked an SPF record entirely. Conversely, 77% of the top 1,000 domains possess a valid SPF record, and SPF adoption exceeds 50% among the top ten million domains. This disparity suggests that higher-profile organizations have stronger incentives to implement SPF, while smaller domains lag behind.

SPF also enables DMARC, the enforcement layer that prevents email spoofing at scale. Without properly configured SPF, organizations cannot fully leverage DMARC's protection against domain impersonation and phishing.

What are the limitations of SPF?

DNS lookup limit creates scalability challenges. The 10 DNS lookup limit imposed by RFC 7208 becomes a major obstacle for organizations using multiple third-party email senders. Each "include" statement in an SPF record can consume 3-4 DNS lookups, meaning organizations using just three or four email service providers can approach or exceed the limit. When this happens, SPF verification fails with a PermError, potentially causing legitimate email to be rejected.

SPF cannot verify message content authenticity. SPF only validates that the sending server's IP address is authorized; it provides no protection against message content tampering. An attacker who compromises an authorized mail server can send malicious content while passing SPF checks. This is why SPF must be combined with DKIM, which cryptographically signs message content.

SPF validates MAIL FROM, not the visible From header. Users see the "From" header in their email client, but SPF validates the "MAIL FROM" address used in the SMTP protocol. These can be different, allowing attackers to spoof the visible From address while passing SPF. Only DMARC alignment prevents this type of header spoofing.

Email forwarding breaks SPF alignment. When a legitimate email server forwards a message, the forwarding server becomes the new sender from SPF's perspective. Since the forwarding server's IP typically isn't listed in the original domain's SPF record, the forwarded email fails SPF verification. This creates challenges for organizations using mailing lists, forwarding services, or shared mailboxes.

SPF records become complex and difficult to manage. As organizations add more email service providers, marketing platforms, and SaaS tools, SPF records grow increasingly complex. Managing multiple "include" statements, tracking which services are still in use, and staying within the 10 DNS lookup limit requires ongoing maintenance that many organizations struggle to perform consistently.

How can organizations optimize SPF deployment?

Organizations should implement SPF as part of a comprehensive email authentication strategy rather than relying on it alone. SPF works best when combined with DKIM for message integrity verification and DMARC for enforcement and visibility into authentication results.

Use SPF record flattening tools to address the 10 DNS lookup limit. These tools consolidate multiple "include" statements into explicit IP address ranges, reducing the number of DNS lookups required during verification. However, flattened records require regular updates when third-party providers change their IP addresses.

Regularly audit SPF records to ensure they remain current and don't exceed the DNS lookup limit. Remove authorization for email service providers no longer in use, and verify that all current senders are properly listed. Tools like Cloudflare's SPF validator, MxToolBox, and EasyDMARC can help identify configuration issues before they cause delivery problems.

List specific IP address blocks rather than overly broad ranges when configuring SPF records. While broad ranges simplify management, they also authorize more servers than necessary, increasing the risk that a compromised server within the range could send malicious email that passes SPF.

Monitor SPF failures through DMARC aggregate reports. These reports reveal which IP addresses are attempting to send email claiming to be from your domain and whether they're passing SPF checks. This visibility helps identify both spoofing attempts and legitimate senders that aren't properly authorized in your SPF record.

Consider implementing DMARC enforcement policies once SPF is properly configured. Moving from DMARC monitoring (p=none) to enforcement (p=quarantine or p=reject) protects your domain's reputation by instructing receiving servers to reject unauthenticated email claiming to be from your domain.

FAQs

What's the difference between SPF and DKIM?

SPF verifies the sending mail server's IP address is authorized for the domain via DNS records, while DKIM uses cryptographic signatures to prove the message content hasn't been altered during transmission. SPF checks the MAIL FROM address used in SMTP; DKIM protects message integrity and survives email forwarding better than SPF. Both are needed for comprehensive authentication, as SPF prevents IP-based spoofing while DKIM prevents content tampering.

Why does SPF have a 10 DNS lookup limit?

RFC 7208 sets this limit to prevent Denial-of-Service attacks against DNS infrastructure. If SPF records could trigger unlimited DNS queries, attackers could craft records that cause receiving mail servers to perform hundreds or thousands of lookups per email, overwhelming DNS servers. When SPF evaluation triggers more than 10 DNS lookups, it fails with a PermError to protect DNS resources, even if the sender would otherwise be authorized.

How do I fix "SPF PermError: Too Many DNS Lookups"?

Reduce the number of "include" statements in your SPF record or use SPF flattening tools to consolidate multiple includes into a single list of IP addresses. Review your SPF record to identify third-party email service providers you've authorized, and remove any that are no longer in use. Each "include" can consume multiple DNS lookups, so even removing one or two unused services can bring you back under the limit.

Is SPF enough to prevent email spoofing?

No, SPF is necessary but insufficient on its own. It only validates the MAIL FROM address via DNS lookups, not message content or the visible From header that users see. Attackers can spoof the displayed From address while passing SPF checks. Combined with DKIM for cryptographic message signing and DMARC for enforcement and alignment verification, SPF creates a more robust authentication framework that addresses multiple spoofing vectors.

What happens if someone spoofs my domain in the visible From header?

SPF alone cannot prevent this type of spoofing because it validates the MAIL FROM address used in SMTP protocol, not the displayed "From" header that users see in their email client. This is precisely where DMARC becomes critical. DMARC enforces alignment between the domain that passes SPF or DKIM authentication and the displayed From domain, preventing attackers from spoofing your domain in the header users actually see.

Alway Automate, Nothing To Manage

Always automated.

Nothing to manage.

Always automated.

Nothing to manage.

Leave Training & Simulated Phishing to us.

Leave Training & Simulated Phishing to us.

Alway Automate, Nothing To Manage

Always automated.

Nothing to manage.

Leave Training & Simulated Phishing to us.

© 2026 Kinds Security Inc. All rights reserved.

© 2026 Kinds Security Inc. All rights reserved.

© 2026 Kinds Security Inc. All rights reserved.