cPanel script to add SPF and DKIM

There is a script available on every cPanel servers by default to enable the SPF and DKIM records via command line.  This will surely help when there is a need of adding the records for many accounts at the same time.

If the SPF is only for a single account, do it like the following:

 

# /usr/local/cpanel/bin/spf_installer $username

Replace $username with the actual cPanel username.

 

If the DKIM is only for a single account, do it like the following:

 

#  /usr/local/cpanel/bin/dkim_keys_install $username

Replace $username with the actual cPanel username.

 

These commands will help you to enable email authentications for single cPanel users. If you have many accounts and you want to enable SPF and DKIM for all accounts, please follow the simple for loop.

 

Here we can get the cPanel usernames from “/var/cpanel/users”. Then give that to installations scripts. Please see the sample script below:

 

for username in `ls -A /var/cpanel/users` ; do

/usr/local/cpanel/bin/dkim_keys_install $username  &&

/usr/local/cpanel/bin/spf_installer $username ; done

 

You can paste this on a text file and make it executable and run it, and you are done!

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

DDoS protection

We are providing DDoS protection packages up to 20 Gbps in both Romania and Netherlands...

Difference between Addon, Parked, and Subdomains

Domain A domain name is an address for the website you are having. This is used to access it via...

Powered by WHMCompleteSolution