Why do I want to have SPF records for my domains?
Many mail servers are now testing for the presence of SPF records so if you don’t have one your email will probably not be delivered to that server. A good example is Hotmail that is testing for SPF records since 2004.
What syntax should I use?
Now that you have learnt what it is and why you should use it, it’s time to see what syntax you should use.
For SPF to work you have to add to each DNS zone a record similar to this:
How to install SPF records?
Now that we know what they are and how to write them it’s time to install them.
I’ll divide my presentation in two sections.
In the first one I will teach you how to add a SPF record automatically to newly created accounts and in the second section how to add them to domains that are already setup and don’t have them.
If this is a new cPanel server or you want all the domains that you add on the server from now on to have a SPF record you have to do the fallowing:
- Login to WHM using root
- Click on Edit Zone Templates and then on “standard”
- Add at the end of file:
- Repeat step 2 and 3 for the “simple” zone template
%domain%. IN TXT “v=spf1 a mx -all” You can replace “v=spf1 a mx -all”
with the syntax that you decide it’s the best for you.
That’s it ! From now on all the accounts that you will create on the server will have a SPF record.
Now what do we do with all the accounts that are already created and don’t have a SPF record?
Here is a simple bash script to do this for you.
Run as root the fallowing:
Wait for it to finish. (it might take a few minutes!).
That’s about it. Hope it helps a lot a people !
REFERENCES
http://blog.goodealhosting.cn/2010/02/how-to-install-spf-records-on-a-cpanel-server/