How to add a SPF record through WHM to prevent mails from of your domain from going to the spam folder?

By | 22nd May 2013 | 2 min read

One of our Drupal clients had reported that the emails from the Google Apps mail accounts on their Drupal site were going into the spam folder of the recipients inbox. When we analyzed the situation we noticed that the SPF records for the domain were not set correctly. Read on to know how to add a SPF record through WHM to prevent mails from of your domain from going to the spam folder.

What is an SPF

SPF(Sender Policy Framework) is a DNS text record that specifies which mail server can sent the email on behalf of our domain.
If our domain does not have a SPF record, the recipients cannot determine whether this mail was send from an authorized mail server or not which will often result in our mails being send to their spam folder. To avoid this we have to add an SPF record for our domain. Using this we can also prevent spam mails which is coming from other sites with 'our domain' From address.

For example: If our domain uses Gmail for sending mail, then we have to create a SPF record which identifies the Gmail server as our authenticated mailserver. This will result in all mails except the one from Gmail to be marked as spam.

Configuring the SPF

Here is an example of how you can configure an SPF record for your domain

  1. Login to WHM
  2. Select the edit zone from the side menu
  3. Select domain name from drop-down list.
  4. Edit the txt file to
    v=spf1 +a +mx +ip4:204.197.252.69 include:_spf.google.com ~all"


In this rule,

  1. + qualifier stands for accept mail or allowed to send.
  2. a - indicates the A record of domains
  3. +mx +ip4:204.197.252.69 - allow mails from this domain.
  4. include:_spf.google.com - allow mails from google apps server
  5. ~all - accept all mails and mark as spam mail which is not sent from the authorized mail server.


For testing SPF records, you use this site http://www.kitterman.com/spf/validate.html

Hope the article was helpful. Use the comment form below to give your feedback regarding the article

References:

  1. SPF Record Syntax
  2. Understanding SPF records