The Sender Policy Framework (SPF) is an essential technique for authenticating emails, designed to combat email spoofing and phishing schemes. It enables domain administrators to designate which mail servers are permitted to send messages on behalf of their domain. Upon receiving an email, the mail server of the recipient consults the SPF record found in the sender’s DNS configuration to confirm whether the email comes from an approved source.
Properly implementing SPF enhances both email deliverability and security while also decreasing the likelihood of being marked as spam. This article will guide you through the process of creating an SPF record step-by-step and outline the best practices for effective email authentication.
An SPF record is a type of TXT record incorporated into a domain's Domain Name System (DNS). This record specifies which IP addresses and mail servers are authorized to send emails for that domain. Emails dispatched from servers not on this approved list could be flagged as spam or potentially blocked.

Before setting up an SPF record, identify every mail server and external service that dispatches emails using your domain. This encompasses:
SPF records adhere to a particular format and consist of components that indicate which email servers have permission to send emails on behalf of a domain. The frequently used components are:
Here’s a simple example of an SPF record:
v=spf1 ip4:192.168.1.1 include:_spf.google.com -all
Breakdown:
After generating the SPF record, it needs to be incorporated into the DNS configuration for your domain:
Once you've published the SPF record, ensure its accuracy by utilizing various online verification tools, including:
These resources will help identify any mistakes and verify the validity of your SPF record.

When utilizing various third-party email services, opt for the include: method rather than specifying each IP address. For instance:
v=spf1 include:_spf.google.com include:spf.protection.outlook.com -all
SPF restricts 10 DNS lookups. Surpassing this threshold may lead to failures in SPF validation. To prevent this issue:
The -all mechanism rigorously upholds SPF by denying any senders that aren't authorized. If you're in the testing phase, consider using ~all (soft fail) before moving to -all.
Set up DMARC (Domain-based Message Authentication, Reporting, and Conformance) to gain visibility into issues with email authentication. Here’s a simple example of a DMARC record:
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com;
This configuration places unauthorized emails in quarantine and forwards reports to the designated email address. Visit www.autospf.com for more details.