How to Change a Contact Email for a cPanel Account via CLI?

  Uncategorized

Introduction:

In a cPanel/WHM environment, each cPanel account has a contact email address that is used to receive important notifications such as backup alerts, disk usage warnings, security notices, and account-related system messages.

Prerequisites:

  • Root or sudo access to the server
  • A server running cPanel/WHM
  • The cPanel username and the new contact email address

Method 1: Change Contact Email Using WHM API (Recommended)

This is the official and safest method, as it updates the account through WHM’s API.

Command:

$ whmapi1 modifyacct user=CPANEL_USERNAME contactemail=NEW_EMAIL

Example:

$ whmapi1 modifyacct user=testuser contactemail=admin@example.com

Method 2: Change Contact Email Using UAPI (User-Level).

Command

$ uapi –user=CPANEL_USERNAME Contactus set_contact_emails email=admin@example.com

Multiple Email Addresses:

$ uapi –user=CPANEL_USERNAME Contactus set_contact_emails email=admin@example.com,ops@example.com

Verification:

After updating the contact email, you can verify the change using the following commands:

$ whmapi1 accountsummary user=CPANEL_USERNAME | grep -i contact

Conclusion:

Updating the contact email for a cPanel account via the command line is a simple but important administrative task. Using WHM API (whmapi1) or UAPI ensures the change is applied correctly and remains consistent across the system.

LEAVE A COMMENT