Add SPF Records and DKIM keys in cPanel


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
  • 12 أعضاء وجدوا هذه المقالة مفيدة
هل كانت المقالة مفيدة ؟

Related Articles

Create Spam Filters for Mailing Lists

This document explains how to create mail filter rules in cPanel's Mailing Lists interface (Home...

Video: Create Email Filter in cPanel

This video tutorial provides Step-by-Step instructions for creating an email filter in cPanel...

Video: Using Webmail in cPanel

This video tutorial provides Step-by-Step instructions for using Webmail in cPanel Shared Hosting...

Video: Create Email Address in cPanel

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

Video: Add Subdomain in cPanel

This video tutorial provides Step-by-Step instructions for adding a subdomain in cPanel Shared...