Post Date: July 7 , 2025
Last Updated: November 22, 2026
Introduction
Managing email accounts is a common task for cPanel server administrators. While cPanel provides a user-friendly interface for creating and managing email accounts, administrators can also perform these tasks directly from the command line using cPanel UAPI.
The cPanel UAPI (Universal Application Programming Interface) allows administrators to manage various cPanel features through command-line commands. It is particularly useful when managing multiple email accounts, automating server administration tasks, or removing unused email addresses without accessing the cPanel interface.
In this guide, you will learn how to delete an email account using cPanel UAPI from the command line, identify the associated cPanel username, list existing email accounts, and safely remove a specific email address.
Prerequisites
Before proceeding, ensure that you have:
- SSH access to the cPanel server.
- Root or appropriate administrative privileges.
- An active cPanel account and domain.
- The email address you want to delete.
- Basic knowledge of Linux command-line operations.
Step 1: Connect to the cPanel Server via SSH
First, connect to your cPanel server using SSH with root privileges.
ssh root@server-ip-address
Replace server-ip-address with your actual server IP address.
If you are already logged in as root, you can proceed to the next step.
Step 2: Identify the cPanel Username
Before deleting an email account, identify the cPanel username associated with the domain.
Run the following command:
grep -l 'DOMAIN' /var/cpanel/users/*
Replace DOMAIN with your actual domain name.
For example:
grep -l 'example.com' /var/cpanel/users/*
The output may look like:
/var/cpanel/users/example
In this example, example is the cPanel username associated with the domain.
Note: You can also verify the account’s domain mapping in WHM or the corresponding cPanel account configuration before proceeding.
Step 3: List Existing Email Accounts
Once you have identified the cPanel username, list the email accounts associated with that account using UAPI.
Execute:
uapi --user=example Email list_pops
Replace example with your actual cPanel username.
This command displays the email accounts configured under the specified cPanel account.
Review the output and confirm that the email address you want to delete exists.
Step 4: Delete the Email Account Using cPanel UAPI
To remove an email account, execute the following command:
uapi --user=example Email delete_pop email=support@example.com
Replace the following values:
example: Your actual cPanel username.support@example.com: The email address you want to delete.
For example, this command removes the support@example.com email account from the cPanel account named example.
Important: Deleting an email account is a destructive operation. Its associated mailbox data may also be removed. Back up any important emails before executing this command.
Step 5: Verify the Email Account Deletion
After executing the deletion command, check the UAPI response to confirm whether the operation was successful.
A successful response may look like this:
metadata:
result: 1
version: 1
command: delete_pop
reason: OK
status: 1
data: {}
The important response fields are:
result: 1– Indicates that the API operation completed successfully.status: 1– Indicates a successful execution.reason: OK– Confirms that the operation returned an OK status.
You can also run the following command again to verify that the email address is no longer listed:
uapi --user=example Email list_pops
If the deleted email address is no longer present, the removal has been completed successfully.
Common Issues and Troubleshooting
If the email account deletion command does not work as expected, check the following:
1. Incorrect cPanel Username
Make sure you are using the correct cPanel username associated with the domain.
2. Email Account Does Not Exist
Verify that the email address is listed using the list_pops command before attempting deletion.
3. Insufficient Permissions
Ensure that you are executing the command as root or with the required administrative privileges.
4. Incorrect Email Address
Check the spelling of the email address and ensure that the domain matches the intended account.
Conclusion
Deleting an email account through cPanel UAPI is a convenient and efficient approach for server administrators who prefer command-line management over the cPanel interface.
By identifying the correct cPanel username, listing existing email accounts, and executing the delete_pop UAPI command, you can remove unwanted email accounts directly from the server terminal.
Always verify the target email address and back up important mailbox data before deletion to avoid accidental data loss.
Using cPanel UAPI can also simplify repetitive administrative tasks and help automate email account management across multiple cPanel accounts.
FAQ’s
1. How can I delete an email account using cPanel CLI?
You can delete an email account using the UAPI Email delete_pop command. Run the command with the appropriate cPanel username and email address:
uapi --user=example Email delete_pop email=support@example.com
2. How can I find the cPanel username associated with a domain?
You can identify the cPanel username by searching the domain in the cPanel user configuration files using the following command:
grep 'DOMAIN' /var/cpanel/users/*
Replace DOMAIN with the actual domain name.
3. Does deleting an email account remove its data?
Yes. Deleting an email account permanently removes the account and its associated email data. Make sure to take any required backups before executing the command.
Related Articles
Official Articles
- Introduction to UAPI – cPanel Documentation
- Email::delpop – cPanel API Documentation
- Manage Email Accounts – cPanel Documentation
Talk to Our Experts
Looking for reliable cPanel management, server administration, or infrastructure support?
Pheonix Solutions provides technology services covering server management, cloud infrastructure, DevOps, website maintenance, and technical support.
Our experts can help you manage cPanel environments, troubleshoot server issues, and maintain reliable hosting infrastructure.
Contact our experts to discuss your requirements.