The Sender Policy Framework (SPF), is a technical standard and email authentication technique that helps protect email senders and recipients from spam, spoofing, and phishing.
Specifically, it defines a way to validate an email message was sent from an authorized mail server in order to detect forgery and to prevent spam. It was designed to supplement SMTP, the basic protocol used to send email, because SMTP does not itself include any authentication mechanisms.
How does SPF work?
SPF establishes a method for receiving mail servers to verify that incoming email from a domain was sent from a host authorized by that domain’s administrators. It piggybacks on the well-established Domain Name System (DNS). In general terms, the process works like this:
- A domain administrator publishes the policy defining mail servers that are authorized to send email from that domain. This policy is called an SPF record, and it is listed as part of the domain’s overall DNS records.
- When an inbound mail server receives an incoming email, it looks up the rules for the bounce (Return-Path) domain in DNS. The inbound server then compares the IP address of the mail sender with the authorized IP addresses defined in the SPF record.
- The receiving mail server then uses the rules specified in the sending domain’s SPF record to decide whether to accept, reject, or otherwise flag the email message.
What is an SPF record?
An SPF record is included in an organization’s DNS database. An SPF record is a specially-formatted version of a standard DNS TXT record. An SPF record looks something like this:
mydomain.com TXT "v=spf1 include:myauthorizeddomain.com include:sparkpostmail.com ~all”
Reading left-to-right in plain English, this record is saying that any email that claims to be from “mydomain.com” should be validated with SPF (that’s the “v=spf1” prefix to the record). It then specifies that the SPF records for “myauthorizeddomain.com” and “sparkpostmail.com” also should be included when validating email from mydomain.com (those are the parts labeled “include:”). In practical terms, that usually is done to indicate that the other domains authorized to send email on its behalf. Finally, the record concludes by stating that any other servers claiming to send mail should be flagged as questionable, and possibly failing, the SPF test (“~all”).
SPF records can be more complicated than this example, but the basic mechanism remains the same.
How is SPF related to DKIM, DMARC, or other standards?
SPF, DKIM, and DMARC are all standards that enable different aspects of email authentication. They address complementary issues.
- SPF allows senders to define which IP addresses are allowed to send mail for a particular domain.
- DKIM provides an encryption key and digital signature that verifies that an email message was not faked or altered.
- DMARC unifies the SPF and DKIM authentication mechanisms into a common framework and allows domain owners to declare how they would like email from that domain to be handled if it fails an authorization test.
Do I need SPF?
If you are a business sending commercial or transactional email, you definitely need to implement one or more forms of email authentication to verify that an email is actually from you or your business. Properly configuring email authentication standards like SPF is one of the most important steps you can take to improve your deliverability. However, SPF by itself only goes so far; SparkPost and other email experts recommend also implementing DKIM and DMARC to define a more complete email authentication policy.
Does SparkPost support SPF?
Yes. SparkPost implements and adheres to email authentication standards including SPF. In fact, SparkPost handles the SPF part of that automatically, so all email from your account is already SPF-compliant.
How can I verify my SPF settings?
SparkPost’s free email tools for developers make working with email authentication standards like SPF easy. Our SPF Inspector lets you quickly check who’s authorized to send email for your domain. And our SPF Builder is an easy way to create a working SPF record for your domain.
Learn More about SPF
Read more about SPF best practices
Learn more about SPF with these resources from SparkPost’s email experts and elsewhere on the web.
Get help with SPF in the SparkPost Support Center
Learn more about how to configure and use SPF with the SparkPost service in the SparkPost Support Center.