Introduction:
In cPanel, email accounts are usually managed through the web interface. However, if you’re comfortable with the command line or managing multiple accounts, using the cPanel CLI with UAPI is a faster and more efficient method. This guide explains how to remove an email account directly from the terminal using a simple UAPI command.
Prerequisites:
- SSH access to the server with root privileges.
- cPanel account and domain are active and properly configure.
Step1:
Log in as root or a privileged user:
| $ ssh root@server-ip-address |
Step 2:
Identify the cPanel Username
$ grep ‘DOMAIN’ /var/cpanel/users/*
Replace ‘DOMAIN’ with the actual domain. It will show the cPanel user.
Step 3:
List Email Accounts
| $uapi –user=example Email list_pops |
Step 4:
To remove the email account support@example.com, and the cPanel username is example.
| $uapi –user=example Email delete_pop email=support@example.com |
Output for example:
A successful command execution might return output like
| metadata: result: 1 version: 1 command: delete_pop reason: OK status: 1 data: {} |
Conclusion:
Using the cPanel UAPI via CLI is a fast and efficient way to manage email accounts on a server. Whether cleaning up unused addresses or automating workflows.