You might be wondering about why or how you need to create an SPF record. In this guide we’ll take a look at this record type and cover why you should set one up.
What’s an SPF Record?
An SPF record is a Sender Policy Framework record. It’s used to indicate to mail exchanges (servers) which hosts are authorized to send mail for a domain.
SPF Record Format
SPF records are defined using the TXT record type. There’s also an SPF record type, but it’s no longer used.
SPF records are defined as a single string of text. Here’s an example record…
v=spf1 +a +mx +ip4:18.104.22.168 ~all
The SPF record always starts with the v= element. This indicates the SPF version that is used. The version should always be spf1 as this is the most common version of SPF that is understood by mail exchanges.
One or more terms follow the version indicator. These define the rules for which hosts are allowed to send mail from the domain, or provide additional information for processing the SPF record. Terms are made up of mechanisms and modifiers. The following mechanisms are defined…
The following mechanisms define which IP addresses are allowed to send mail from the domain…
A mail server will compare the IP address of the sender against the IP addresses defined in the mechanisms. If the IP address matches one of the mechanisms in the SPF record then follow the result handling rule. The default handling rule is + or pass.
The include mechanism allows you to authorize hosts outside of your administration by specifying their SPF records.
The all mechanism matches any address. This is usually used as the last mechanism which defines how to handle any sender IP that did not match the previous mechanisms.
Configuring an SPF Record
Now that we’ve covered how SPF records work, lets see how to set one up in cPanel. As previously mentioned, these will be configured as a TXT record.
You’ll want to log into your cPanel account and locate DNS Zone Editor.
Next you’ll want to click on MANAGE next to the domain you want to add the SPF record for.
On the right side click ADD RECORD and select Add “TXT” Record
The following image shows a typical SPF record should be configured…
Name will be replaced by the domain name you are setting up the record for. The IP address under Record should match the server your site is hosted on. After everything is set up the way you want, click ADD RECORD
You can use a site such as https://www.whatsmydns.net/ to verify the TXT record has been set up correctly.