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, you are done!

  • add spf and dkim, cpanel spf and dkim, command spf dkim, spf, dkim
  • 0 Los Usuarios han Encontrado Esto Útil
¿Fue útil la respuesta?

Artículos Relacionados

How To Install and Use Docker on Ubuntu 16.04

Introduction Docker is an application that makes it simple and easy to run application processes...

Change Main IP of the server :: Vesta Panel

If we are changing the main IP of a server installed with Vesta panel, we can use the following...

cPanel: Apache-FastCGI Data Timeout Error

If you are using a cPanel server and have FastCGI enabled in Apache, you might be facing the...

Domainkey installer in cPanel

You can use the following cPanel script to install domainkey for an account...

Email issues :: Common Troubleshooting Steps

Here I will discuss some common errors and their solution: We are using a mail relay setup for...