How to configure SPF and DKIM in cPanel?

How to configure SPF and DKIM in cPanel?

In this page, we will discuss how to configure SPF and DKIM records in your cpanel. Let us what is SPF and DKIM records and why are used.


What is Sender Policy Framework  (SPF)?

SPF record which stands for Sender Policy Framework can be defined as email verification protocol or is an email-authentication technique by which you prevent spammers from sending emails on behalf of your domain. It is an effective and simple method which lets you avoid such issues like email Quota exceeded due to spammers sending emails on behalf of your domain. If your domain name has correct SPF record then you can be sure nobody is able to send fake emails on behalf of your domain name..


What is DomainKeys Identified Mail (DKIM)?

DomainKeys Identified Mail (DKIM)  is another way of email authentication, which lets an organization take responsibility for a message that is in transit. The organization is a handler of the message, either as its originator or as an intermediary. Their reputation is the basis for evaluating whether to trust the message for further handlings, such as delivery. Technically DKIM provides a method for validating a domain name identity that is associated with a message through cryptographic authentication and it uses information about domain which is published by the domain owner. That information allows receiving server to verify if the e-mail message was sent by the legal owner of that domain provider.


Why do we need to set DKIM?

If Emails from your website goes to spam folders in other vendors, such as Gmail, Yahoo Email and other some other email providers, then you have to set the DKIM records in your website control panel setup. Every mail server while receiving checks for authentication of the Email senders using DKIM and SPF records, If those records are verified or added correctly, then the email will be delivered.  This option or features are available with all the shared hosting plan of HostingRaja customers.

You'll need to add SPF and DKIM records and verify ownership of your sending domains before you can send email through your account. Unlike SPF, you can maintain many DKIM records for various sending sources. Each DKIM record is identified using a selector. In the case, the selector is "pm" as a way to identify Postmark. By using a different key pair for each provider you can easily revoke or renew DKIM records as needed.


Why do we need to set SPF?

Using SPF you can publish authorized mail servers for your domain and also prevent email spoofing by implementing a mechanism for verifying that incoming mail from the domain which comes from the IP Address allowed by that domain's administrators.

The phishing and email spam use faked "from" addresses and domains so that when publishing and checking of the SPF records will be recognized as reliable and easy to use anti-spam procedure hence the record of authorized sending hosts and IP addresses for a domain, when  published in the DNS records of that domain in a uniquely formatted TXT record.

Combined with the DMARC related information, this gives the receiver information on how trustworthy the origin of an email is. SPF gives you the ability to specify which email servers are permitted to send email on behalf of your domain.

ork) is an effective and simple method which lets you avoid such issues. If your domain name has correct SPF record then you can be sure nobody is able to send fake e-mails on behalf of your domain name.


To generate the SPF records

v=spf1 +a +mx ip4:xy.xy.xy.xy ip4:xz.xz.xz.xz -all

Where  xy.xy.xy.xy will be your A record IP and  xz.xz.xz.xz will be your MX record IP


To generate the DKIM records

v=DKIM1; p=yourPublicKey

p=represents public key


You validate records the records and see if they are valid records using a dkim and SPF validator. But in cpanel panel, you can generate SPF and DKIM the records in simple steps.

Follow the below steps for setting up SPF and DKIM records

Step 1: Login  into cPanel your account

Step 2: After login into the cpanel search for authentication  >> under Email section >> click on authentication icon


Step 3: After you select authentication >>  Click on Enable the DKIM >> and click on Enable SPF record. After that, the SPF and the DKIM records will be added to the DNS zone of all hosted domains automatically.


Step 4: After some time when you refresh the page you will status of the enabled record, you should get the status as in the below figure.


Following the below steps you can update the SPF and DKIM records for your domain.



For SPF and DKIM records ( any DNS records) to propagate globally, it will take 24-48 hours.

After you have enabled SPF & DKIM records, You can add additional IP addresses or mail servers that are authorized to send emails to your domain. For example, you may want to do this if you want to use a third-party mail server for sending emails from your domain.

If you are facing any issue or if you have any clarification regarding configuring SPF and DKIM records using your cPanel hosting account, feel free to contact our support team via live chat, email, toll-free or ticket system and our support team is available 24/7.