Remove email account at the back end.
Introduction
Sometimes, while deleting an email account in cPanel, you may encounter an error even though the system shows a success message. This typically happens due to domain ownership or configuration changes within the hosting account.
Error Message
The e-mail address admin@mydomain.com deleted successfully.
Sorry, you do not have access to the domain mydomain.com
Cause
This issue usually occurs in the following scenarios:
- The domain has been moved to another cPanel account
- The domain was converted between addon domain and main domain
- Domain ownership mismatch within cPanel configuration
In such cases, cPanel fails to fully remove the email account due to incorrect or outdated mappings.
Prerequisites
Before proceeding, ensure the following:
- Root or SSH access to the server
- Correct cPanel username (
/home/user/) - Backup of the affected files
Implementation
Step 1: Remove Email Entries from Configuration Files
Edit and remove the respective email account entries from:
/home/user/etc/domainname.tld/passwd
/home/user/etc/domainname.tld/shadow
/home/user/.cpanel/email_accounts.yaml
Step 2: Remove Mail Directory
Delete the corresponding mail directory:
/home/user/mail/mydomain.com/user
Notes
- Replace user with the actual cPanel username
- Replace mydomain.com with your domain name
- Always take a backup before making manual changes
- Incorrect edits may affect other email accounts
Conclusion
This issue occurs due to domain ownership inconsistencies in cPanel. Manually cleaning up the email account entries from configuration files and directories resolves the problem effectively. Proper domain management and cautious migration can help avoid such issues in the future.
