There was a problem loading the comments.

Enable DKIM and SPF for all accounts in cPanel

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
The SPF and DKIM records are a type of Domain Name Service records. This post helps you to enable DKIM and SPF for all accounts in cPanel with a script. The purpose of these records is to prevent spammers. The SPF (Sender Policy Framework) identifies which mail servers are permitted to send email on behalf of your domain.So it will prevent spammers from sending messages with forged “From addresses” at your domain.

DKIM (DomainKeys Identified Mail) is an email validation system designed to detect email spoofing by providing a mechanism to allow receiving mail exchangers to check that incoming mail from a domain is authorized by that domain’s administrators and that the email (including attachments) has not been modified during transport.

We can simply enable the SPF and DKIM records from cPanel (Home >> Mail >> Email Authentication). If you need to enable DKIM and SPF for all accounts in cPanel, it is not possible to manually enable them via cPanel. In that case you can use the following script.

To Enable:

 
cat /etc/trueuserdomains | cut -d: -f2 >> /root/users.txt
for i in `cat /root/users.txt` ;do /usr/local/cpanel/bin/dkim_keys_install $i ;done 
for i in `cat /root/users.txt` ;do /usr/local/cpanel/bin/spf_installer $i ;done

To Disable:

Also, you can disable the DKIM and SPF records on all accounts in cPanel using the following script.

 
cat /etc/trueuserdomains | cut -d: -f2 >> /root/users.txt
for i in `cat /root/users.txt` ;do /usr/local/cpanel/bin/dkim_keys_uninstall $i ;done 
for i in `cat /root/users.txt` ;do /usr/local/cpanel/bin/spf_uninstaller $i ;done

That’s it!

Share via

Related Articles

Copyright © 2022 TheGigabit. All right reserved. Reg.No: 200701034297 (792326-P)