Skip to content

Services, Wiki-Artikel, Blog-Beiträge und Glossar-Einträge durchsuchen

↑↓NavigierenEnterÖffnenESCSchließen

SPF - Sender Policy Framework

SPF is a DNS-based email authentication protocol that specifies which mail servers are authorized to send emails on behalf of a domain, thereby preventing email spoofing.

Table of Contents (5 sections)

SPF (Sender Policy Framework) is a DNS TXT record that lists authorized mail servers for a domain. Receiving mail servers check whether an incoming email was sent from a server listed in this record—and may reject it or mark it as spam if it was not.

SPF is one of the three building blocks of email authentication. The other two are DKIM (cryptographic signature) and DMARC (policy and reporting). All three are necessary for complete email protection.

How SPF works

  1. Sender sends email from info@beispiel.de via server 203.0.113.10
  2. Receiving mail system queries DNS for TXT beispiel.de
  3. SPF record reads: v=spf1 ip4:203.0.113.0/24 -all
  4. IP 203.0.113.10 is within the allowed range → SPF pass
  5. If it is not within the allowed range → SPF fail

Important: SPF checks the envelope From address (technical SMTP MAIL FROM), not the visible From: header in the email. An attacker can pass SPF and still display a false From: header—which is why DMARC (alignment check) is absolutely necessary.

SPF Record Syntax

v=spf1 [mechanisms] [modifier]

Mechanisms

MechanismMeaning
ip4:203.0.113.0/24IPv4 address or range
ip6:2001:db8::/32IPv6 address or range
include:_spf.google.comInclusion of another domain’s SPF record
aThe A record of your own domain
mxAll MX records of the domain
allMatches all sources not previously matched

Qualifiers (before the mechanism)

QualifierMeaningRecommendation
+ (default)Pass - source is authorizedFor allowed sources
-Fail (hard fail) - source is not authorized, rejectionFor all at the end
~Soft fail - not authorized, but do not strictly rejectOnly as a temporary measure
?Neutral - no statementAvoid

Recommended pattern:

v=spf1 include:_spf.google.com ip4:203.0.113.0/24 -all

The 10-DNS-Lookup Limit

SPF allows a maximum of 10 DNS lookups per SPF check. Each include:, a, or mx mechanism counts as one lookup. With many cloud services (Google Workspace, Microsoft 365, Salesforce, HubSpot, Zendesk...), this limit is quickly reached—and SPF aborts with a PermanentError, leading to delivery issues.

Solution: SPF flattening (resolving all includes to direct IP addresses) or using SPF macros. Regularly check with tools like MXToolbox or dmarcian.

Common SPF Errors

Missing -all at the end: Without a trailing qualifier, every server is implicitly neutral—the SPF record provides no protection.

~all instead of -all: A soft fail means recipients will still deliver the email (albeit marked as spam). Only useful during the transition phase.

Forgotten unknown mail sources: Marketing automation, CRM, ERP, ticketing systems—all send emails under the company name and must be included in the SPF record.

Subdomains: SPF records do not automatically apply to subdomains. mail.example.com needs its own SPF record.

SPF in conjunction with DMARC

SPF alone is not sufficient because:

  1. SPF checks the Envelope-From, not the visible From header
  2. SPF often fails with email forwarding (e.g., alumni addresses)

DMARC resolves both issues: It requires SPF alignment (the Envelope-From and From headers must belong to the same domain) and specifies what should happen if alignment fails.

Recommended implementation path:

  1. Set up SPF with -all
  2. Enable DKIM for all mail sources
  3. Enable DMARC with p=none and collect reports
  4. Gradually tighten DMARC to p=quarantinep=reject

Further information: DMARC Wiki article | DKIM Wiki article

Sources & References

  1. [1] RFC 7208 - Sender Policy Framework (SPF) - IETF
  2. [2] Google - SPF-Eintrag einrichten - Google

Questions about this topic?

Our experts advise you free of charge and without obligation.

Free Consultation

About the Author

Chris Wojzechowski
Chris Wojzechowski

Geschäftsführender Gesellschafter

E-Mail

Geschäftsführender Gesellschafter der AWARE7 GmbH mit langjähriger Expertise in Informationssicherheit, Penetrationstesting und IT-Risikomanagement. Absolvent des Masterstudiengangs Internet-Sicherheit an der Westfälischen Hochschule (if(is), Prof. Norbert Pohlmann). Bestseller-Autor im Wiley-VCH Verlag und Lehrbeauftragter der ASW-Akademie. Einschätzungen zu Cybersecurity und digitaler Souveränität erschienen u.a. in Welt am Sonntag, WDR, Deutschlandfunk und Handelsblatt.

10 Publikationen
  • Einsatz von elektronischer Verschlüsselung - Hemmnisse für die Wirtschaft (2018)
  • Kompass IT-Verschlüsselung - Orientierungshilfen für KMU (2018)
  • IT Security Day 2025 - Live Hacking: KI in der Cybersicherheit (2025)
  • Live Hacking - Credential Stuffing: Finanzrisiken jenseits Ransomware (2025)
  • Keynote: Live Hacking Show - Ein Blick in die Welt der Cyberkriminalität (2025)
  • Analyse von Angriffsflächen bei Shared-Hosting-Anbietern (2024)
  • Gänsehaut garantiert: Die schaurigsten Funde aus dem Leben eines Pentesters (2022)
  • IT Security Zertifizierungen — CISSP, T.I.S.P. & Co (Live-Webinar) (2023)
  • Sicherheitsforum Online-Banking — Live Hacking (2021)
  • Nipster im Netz und das Ende der Kreidezeit (2017)
IT-Grundschutz-Praktiker (TÜV) IT Risk Manager (DGI) § 8a BSIG Prüfverfahrenskompetenz Ausbilderprüfung (IHK)
This article was last edited on 03.03.2026. Responsible: Chris Wojzechowski, Geschäftsführender Gesellschafter at AWARE7 GmbH. License: CC BY 4.0 - free use with attribution: "AWARE7 GmbH, https://a7.de"

Cookielose Analyse via Matomo (selbst gehostet, kein Tracking-Cookie). Datenschutzerklärung