The SPF and DKIM records are kind of Domain Name Service records. These records are used to prevent spammers.
SPF
The SPF (Sender Policy Framework) recognizes which mail servers are allowed to send email on behalf of your domain. So it will keep spammers from sending messages with forged”From addresses” at your domain.
DKIM
DKIM (DomainKeys Identified Mail) is an email acceptance framework intended to identify email spoofing by providing a mechanism to allow receiving mail exchangers to check that incoming mail from a domain is approved by that domain’s administrators and that the email (including attachments) has not been altered during transport process.
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, 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:
We 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
We can also turn on email authentication features SPF and DKIM by-default for all newly creating cPanel accounts within cPanel .
You can check this from this location:
Home » Server Configuration » Tweak Settings
Enable DKIM on domains for newly created accounts
Enable SPF on domains for newly created accounts
Done!!