Add SPF Records and DKIM keys in cPanel


For Shared Hosting and Reseller Hosting accounts from Rad Web Hosting, the DKIM keys will be automatically generated for domains associated with the account.

This article provides various methods for adding DKIM keys and SPF records to cPanel domains. Root-Level WHM server access is required.

Add DKIM Keys for a Single User

Login as root user via SSH and run the following command:

/usr/local/cpanel/bin/dkim_keys_install username

Replace "username" with the account's username.

Add DKIM Keys for All Users

for user in `ls /var/cpanel/users`; do /usr/local/cpanel/bin/dkim_keys_install $user; done

Add SPF Records for a Single User

As root user, run the following command:

/usr/local/cpanel/bin/spf_installer username

Replace "username" with the account's username.

Add SPF Records for a All Users

for user in `ls /var/cpanel/users`; do /usr/local/cpanel/bin/spf_installer $user; done

Setup Server to Create DKIM / SPF Records on New Account Creation

Edit the /scripts/postwwwacct file using your preferred text editor, such as:

nano /scripts/postwwwacct

Add the following at the end of the file:

print "\nInstalling DKIM / SPF Records for $name ...";
system("/usr/local/cpanel/bin/dkim_keys_install $name");
system("/usr/local/cpanel/bin/spf_installer $name");

Shell Script to Add DKIM / SPF Records for All Users:

#!/bin/bash
for user in `ls /var/cpanel/users`
do
echo "Installing SPF Record for $user...";
/usr/local/cpanel/bin/spf_installer $user;
echo "Installing DKIM Record for $user...";
/usr/local/cpanel/bin/dkim_keys_install $user;
done
  • spf records, dkim keys, email authentication, spam protection
  • 14 Usuários acharam útil
Esta resposta lhe foi útil?

Related Articles

Video: Create Email Address in cPanel

This video tutorial demonstrates how to create an email address using cPanel Shared Hosting...

Remove a Service from ChkServd Monitoring for cPanel Servers

This guide requires root user account in server. In some circumstances, ChkservD cPanel...

How to Edit Zone File and Setup DNS Forwarding

To perform DNS forwarding, change your zone file, (MX, A-Records & CNAME) using the following...

Assigning a Dedicated IP Address to a Subdomain using WHM

To assign a dedicated IP address to a subdomain, perform the following steps: Step 1: Add the...

Update Nameservers for Domains Registered at GoDaddy

After signing up for a hosting account, you will receive a Welcome email containing important...