How to add spf record for subdomain on cpanel (gitlab case)

This is a long time draft that I thought already publish till I update some wordpress plugin. My friend who open software house came send me private message. He ask me if I have an idea why his email not delivered. He install a software called gitlab. This software basically manage operation of git from web based application.

After login to his server I realize that his vps provider blocked port 25. This port is designed for send email. To overcome this issue just open a ticket and told them about the problem. Attach the output of this command :

mailq

After few minutes (almost one hour) ticket responded and port unblocked. Now I see email arrive to mailbox.

Another issue is spf record. As provider try to secure their network from spam then our job is make sure from our server there is no spam. spf record is one thing we can do from client side.

This picture basically told if spf record is not set.

spf_none

In gmail to get that view you can click “show original” from next arrow icon.

gmail_original

To set spf record for this subdomain just login to cpanel and choose “advance dns” and enter the data like this illustration.

gitlab_spf_email_cpanel

Name : fill hostname here.

TTL : 1440

Type : TXT

TXT Data : v=spf1 a ip4:12.24.56.789 ?all (change 12.34.56.789 to your public ip)

Click Add Record.

Try to send other email (do something like change email member of gitlab) and check the result.

spf_pass

Gmail told that spf record properly and pass their examination.

My friend happy and I got new experience 🙂