On Monday we looked at SPF records and why they are important specifically to spam filters and email security in general. So today, lets take a look at how you create an SPF record for your domain.
As a quick review, an SPF record is a DNS based text string that a receiving email server can query and parse to find out what IP addresses the domain owner says should be sending email for the domain. Now, at first it seems like creating the SPF should be a pretty simple task. Simply use the syntax to say “these are my legitimate IPs”. But, it’s a little more complicated than that. SPF has a number of options which allow the domain owner to add some nuance to the result.
I’m not going to delve into all the possibilities here. But a great resource site for you is the OpenSPF project site. So, here is a breakdown of the SPF syntax where you can dissect all of the possibilities. Let’s look at two of the most common setups though:
1. First let’s look at an example of an SPF record that says “My MX records are the same and ONLY IP addresses I use to send outbound email”. This record would look like “v=spf1 mx -all”. Where “v=spf1″ gives the version of SPF used and “mx” is the command to allow all IPs that are associated to the A records in your MXs and “-all” specifically disclaims any other IPs. ***WARNING*** if you are using Mailprotector or another cloud based email security service do NOT create this SPF. Your MX records are not the same IPs that you send outbound mail through.
2. Now, here is an example of an SPF record that specifically defines the IP addresses which send mail. This record says “These are the ONLY IP addresses which send mail for my domain”: “v=spf1 ip4:192.168.0.1/16 -all”. For IP ranges, SPF uses CIDR notation. In this record “v=spf1″ again defines the version of SPF used, “ip4:192.168.0.1/16″ says “allow all ip4 addresses from 192.168.0.1 to 192.168.255.255″ and the “-all” again specifically disclaims all other addresses. So, you simply substitute your IP(s) or range(s) for the one listed in this example. If you have multiple, just add them one after another with a space between keeping the “-all” at the end. If you are a Mailprotector customer and using our outbound filtering you can get a list of the possible outbound sending ranges from the Help tab in your console.
The OpenSPF site has a great FAQ and Common Mistakes section.
Now, in conclusion I’ll just add the nice big disclaimer…use at your own risk; while not an SPF expert I do play one on TV; past SPF functionality does not guarantee future performance; the author of this article specifically disclaims any shred of truth to this material in this universe or any other. Seriously though, check out the OpenSPF site and go create your record. It’s simple and will help prevent your domain from being forged.

