Plesk: cannot remove email/domain/client: mailmng failed: Some errors occured

If the mail handlers in Plesk are corrupt, you will be unable to remove the email account OR a domain from the Plesk control panel and will result 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) To remove the email account via 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, first we will delete the password of the email account from the ‘accounts’ table by executing the below query:

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 ‘xyz’ 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 you will be able to remove the email account from the Plesk control panel.

This entry was posted on Monday, December 27th, 2010 and is filed under Plesk Management. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

2 Responses to “Plesk: cannot remove email/domain/client: mailmng failed: Some errors occured”

  1. immortal

    Very useful! Rather than calling tech support, I tried out your suggestions here, and it worked like a charm. Thank you! Plesk seems to be a lot more complicated sometimes than it should be.

  2. Geremy

    Fantastic!! I was having no luck sloving this issue using any method, that MySQL method worked a treat!!