What is SPF? (Sender Policy Framework)

💡

What You'll Learn

SPF (Sender Policy Framework) is one of the most important tools for proving that an email really comes from the server it claims. In this lesson, we’ll learn what SPF is, why it matters, and how it works in practice.

📖 What is SPF? (Sender Policy Framework)

Lesson 8

What is SPF?

SPF stands for Sender Policy Framework. It’s a DNS record that tells email servers which IP addresses or mail servers are allowed to send emails on behalf of your domain.
Think of SPF as a “guest list” at a club. If your mail server is on the list, the email is welcomed. If it’s not, the email may get flagged as suspicious or spam.

Why Does SPF Matter?

  • Prevents email spoofing → stops bad actors from pretending to send from your domain.
  • Improves deliverability → ISPs (like Gmail, Outlook, Yahoo) trust authenticated emails more.
  • Works with other protocols → SPF is often paired with DKIM and DMARC.

How SPF Works (Step by Step)

  • You publish an SPF record in your domain’s DNS (e.g., v=spf1 include:sendgrid.net ~all).
  • When you send an email, the recipient’s mail server checks: 
    “Does this IP/server match the SPF record for this domain?”
        If yes → The email passes SPF.
        If no → The email may be marked spam or rejected.

Example SPF Record

v=spf1 include:_spf.google.com include:sendgrid.net ~all
  • v=spf1 → version of SPF.
  • include:_spf.google.com → allow Google Workspace servers.
  • include:sendgrid.net → allow SendGrid.
  • ~all → soft fail (not authorized, but don’t fully block).

Common Mistakes with SPF

  • Forgetting to add all email services (e.g., Gmail + SendGrid + Mailchimp).
  • Adding too many include: statements (SPF has a 10-lookup limit).
  • Using all (hard fail) without testing → may block valid emails.

🥋 Sensei Tip 

Think of SPF as your dojo’s entry gate. You decide who’s allowed inside to represent you. If you don’t set the rules, anyone can walk in pretending to be your student — and ruin your reputation.
⏱️ Est. reading time: 2 minutes

Continue Learning

Navigate through your learning journey

Email deliverability help