Wrinkles

Everyday skincare basics, explained plainly

SPF Cybersecurity Policy: What It Is & How to Use It

· 7 min read · Ingredients Explained

An SPF cybersecurity policy is a technical standard that lets a domain owner publish a list of mail servers authorized to send email on their behalf, helping to prevent email spoofing and phishing. It is implemented as a DNS TXT record that receiving mail servers check to verify that an incoming message claiming to come from your domain actually originated from an approved server.

Background: Why SPF Exists

Email was designed in an era when the internet was a trusted network, so the protocol that routes messages (SMTP) does not include any built-in authentication. That means anyone can craft an email that claims to be from any address, including your bank, your boss, or your own domain. Attackers exploit this to send phishing emails that look legitimate, tricking recipients into revealing passwords or transferring money.

SPF (Sender Policy Framework) was created in the early 2000s as one of the first practical defenses. It works by letting domain owners publish a list of IP addresses that are allowed to send mail for their domain. When a receiving server gets a message, it looks up the SPF record for the claimed sender domain and checks whether the sending IP is on that list. If not, the message can be flagged as suspicious or rejected.

SPF is now an open standard defined in RFC 7208, and it is one of the three main email authentication methods, alongside DKIM (DomainKeys Identified Mail) and DMARC (Domain-based Message Authentication, Reporting, and Conformance). Together they form a layered defense against email impersonation.

How SPF Works: A Step-by-Step Look

When you send an email, the receiving server performs these checks:

  1. It extracts the domain from the envelope sender address (the Return-Path, not the visible From header).
  2. It queries the DNS for the SPF record of that domain. The record is a TXT record that starts with v=spf1.
  3. It evaluates the record, which contains a list of mechanisms (like ip4:, include:, a, mx) that define which IPs are allowed.
  4. It applies the qualifier at the end (usually -all for hard fail, ~all for soft fail) to decide the final result: pass, fail, or neutral.
  5. It acts on that result based on its own policy—often in combination with DMARC—to deliver, quarantine, or reject the message.

For example, if your domain is example.com and you send mail from a server at 203.0.113.10, your SPF record might look like: v=spf1 ip4:203.0.113.10 -all. The -all means “only this IP is allowed; reject everything else.”

How to Choose and Set Up an SPF Policy

Setting up SPF requires careful planning because a mistake can cause legitimate email to be rejected. Here are the steps:

  1. List every server that sends email for your domain: your own mail server, your email service provider (like Google Workspace or Microsoft 365), your marketing platform, your CRM, and any third-party service that sends transactional emails.
  2. Find the IP addresses or hostnames for each sender. Many providers publish an include: directive (e.g., include:_spf.google.com) that you can reference instead of listing IPs.
  3. Construct your SPF record. Start with v=spf1, then add mechanisms for each sender, and end with -all if you are confident you have covered everything, or ~all if you are still testing.
  4. Publish the record as a DNS TXT record at your domain root (e.g., example.com).
  5. Test it using an SPF validation tool or by sending test emails to accounts you control.
  6. Monitor delivery reports and adjust if any legitimate service is missing.

A common mistake is forgetting to include all senders. For example, if you use a third-party email marketing service and don’t add its include: directive, your marketing emails will fail SPF and may go to spam.

Common Problems and Misconceptions

One widespread misconception is that SPF alone stops spoofing. It does not. SPF only checks the envelope sender domain, which is often not visible to the recipient. Attackers can spoof the visible From address while using a different envelope domain, and SPF will pass. That is why SPF is usually paired with DKIM and DMARC.

Another issue is the 10-lookup limit. RFC 7208 limits the number of DNS lookups an SPF record can trigger to 10, to prevent denial-of-service attacks. Each include:, a, mx, or ptr mechanism counts as a lookup. If you exceed 10, the record is considered invalid and SPF fails. To avoid this, you can consolidate mechanisms or use IP ranges instead of multiple includes.

Also, SPF records cannot be used to authenticate messages that are forwarded. When an email is forwarded, the original sender’s SPF check may fail because the forwarding server is not in the original SPF record. This is a known limitation that DMARC helps mitigate.

SPF vs. DKIM vs. DMARC

SPF, DKIM, and DMARC are complementary, not interchangeable:

  • SPF verifies the sending server’s IP against an authorized list.
  • DKIM uses a digital signature to verify that the message content was not altered and that it came from a domain that holds a private key.
  • DMARC tells receiving servers what to do if both SPF and DKIM fail, and it provides reporting so you can see who is sending mail using your domain.

Using only SPF leaves gaps. For example, an attacker can spoof your domain in the From header while using a different envelope domain, and SPF will not catch it. DMARC aligns the From domain with the authenticated domains, closing that loophole.

Costs and Maintenance

Publishing an SPF record is free—it is just a DNS entry. The cost is in time and expertise: you need to maintain the record as your sending infrastructure changes. If you add a new email service, you must update the SPF record or your emails may fail authentication.

There is no ongoing fee, but you may choose to use a third-party SPF validation service or a managed email security platform that includes SPF monitoring. Those services often have subscription fees, but the core SPF standard itself has no cost.

Safety and Best Practices

To avoid breaking email delivery, follow these guidelines:

  • Start with ~all (soft fail) while testing, then switch to -all once you are confident.
  • Never use +all because it tells receivers to accept mail from any IP, which defeats the purpose.
  • Keep your SPF record under the 10-lookup limit.
  • Combine SPF with DKIM and DMARC for robust protection.
  • Regularly review your SPF record and remove outdated entries.

Remember that SPF is not a security tool in the traditional sense—it is an authentication mechanism. It does not encrypt email or protect against malware. Its purpose is to reduce spoofing, which in turn reduces phishing and fraud.

Frequently Asked Questions

What does SPF stand for in cybersecurity?

SPF stands for Sender Policy Framework. It is an email authentication method that allows a domain owner to specify which mail servers are permitted to send email on behalf of that domain.

How do I check if my domain has SPF?

You can use a DNS lookup tool or a command-line tool like nslookup -type=TXT example.com. Look for a TXT record that starts with v=spf1. Many free online SPF checkers are also available.

What does -all vs ~all mean in SPF?

-all means hard fail: if the sending IP is not listed, the message should be rejected. ~all means soft fail: the message is not rejected but is marked as suspicious, often landing in spam. Hard fail is stricter but risks rejecting legitimate mail if you miss a sender.

Can SPF prevent all email spoofing?

No. SPF only checks the envelope sender domain, which is not visible to recipients. Attackers can spoof the visible From address while using a different envelope domain, and SPF will pass. That is why SPF is usually paired with DKIM and DMARC.

What happens if I don’t have an SPF record?

Your domain is more vulnerable to spoofing because receiving servers have no way to verify that an email claiming to be from your domain actually came from you. This can increase the risk of phishing attacks against your customers or employees.

How often should I update my SPF record?

Update it whenever your email infrastructure changes, such as adding a new email service provider, changing mail servers, or retiring an old one. It is good practice to review it periodically, at least once a year.

In this article
  1. Background: Why SPF Exists
  2. How SPF Works: A Step-by-Step Look
  3. How to Choose and Set Up an SPF Policy
  4. Common Problems and Misconceptions
  5. SPF vs. DKIM vs. DMARC
  6. Costs and Maintenance
  7. Safety and Best Practices
  8. Frequently Asked Questions