If the mail handlers in Plesk are corrupt, you will be unable to remove the email account OR the domain from the Plesk control panel which results in the following error
—————————————–
mailmng failed: Some errors occured. See log for details
0: class.MailManager.php:242
MailManager::execWithException(string ‘smart_exec’, string ‘mailmng’, array, array, string ‘lst’)
1: class.MailManager.php:274
MailManager->callMailManager(string ‘remove-mailname’, array)
2: class.MailManager.php:354
MailManager->removeMailname(string ‘domain.tld’, string ‘emailid’)
—————————————–
The one of the following 3 methods can be used to resolve the issue:
1) To remove and re-create the mail handlers using the ‘mchk’ script and then deleting the email account from Plesk. For detailed steps, click here
2) If the above method doesn’t work, remove the email account from SSH.
# /usr/local/psa/bin/mail --remove email@domain.tld
3) If the above 2 methods doesn’t work, remove the email account from the Plesk database manually (backup the ‘psa’ database first). Let’s use the email ID as “xyz@abc.com” as an example here (of-course, it should be replaced with the actual values in your queries).
Connect to the psa database from SSH:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa
Retrieve the domain ID of abc.com
mysql> select id from domains where name="abc.com";
Now, delete the password of email account from the ‘accounts’ table
mysql> delete from accounts where id in (select mail.id from mail INNER JOIN \ domains ON mail.dom_id=domains.id where domains.name='abc.com' AND \ mail.mail_name='xyz');
Now, delete the email name from the ‘mail’ table (replace ‘ID’ with the id retrieved from the first query)
mysql> delete from mail where dom_id='ID' AND mail_name='xyz';
Once done, restart the Mysql service and remove the email account from the Plesk control panel. That’s it.