Are you trying to use "mchk" Utility in Plesk?
This guide is for you.
The mchk Utility in Plesk helps to rebuild all mail configuration files. In addition, it restores the settings for all mailboxes created in Parallels Plesk Panel.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Plesk related queries.
In this context, we shall look into how to use Plesk Utility to fix errors.
More information about mchk utility?
Mchk plesk utility sets proper ownership and permissions for all mailboxes. And, It rebuilds mail server control files mailboxes settings.
In addition, it sets appropriate permissions for all the related files. In short, it will rebuild the mail configuration or recreate the broken mail handlers.
How to use mchk utility in plesk?
Recently, one of our customers approached us with the request to provide him the steps to perform mchk utility in both Windows and Linux.
Since it will cause some downtime, we recommended running it only during off-peak hours.
The steps we follow both in Linux and Windows are given below:
We usually follow the steps below:
1. Parallels Plesk Panel for Windows
C:\Parallels\Plesk\admin\bin>mchk.exe –all –fix=all
2. Parallels Plesk Panel for Linux
i. Firstly, we stop the mail service
ii. Next, backup old handlers:
cp -a /usr/local/psa/handlers/before-* /root/temp/
cp -a /usr/local/psa/handlers/info /root/temp/
iii. Then, we delete all the mail handlers:
rm -rf /usr/local/psa/handlers/before-*/*
rm -rf /usr/local/psa/handlers/info/*
iv. After that, we run mchk utility to recreate mail handlers:
v. Finally, we start the mail service:
By performing these steps we helped our customer with his query regarding mchk.
Common Errors of plesk mchk utilty ?
Moving ahead, let us focus on a few errors and its fix in detail.
a) Plesk repair mail or mchk fails: mail_outgoing_restore… fail
The symptoms of this error include:
Plesk repair mail or /usr/local/psa/admin/sbin/mchk command fails:
==> Checking for: mail_outgoing_restore... fail
Some utilities have exited with errors:
The following files present on the server:
# ls -al /usr/lib/plesk-9.0/mail_postfix_transport_restore
-rwxr-x--- 1 root root 348 Mar 1 2018 /usr/lib/plesk-9.0/mail_postfix_transport_restore
# ls -al /usr/lib/plesk-9.0/remote_mail_restore/mail_outgoing_restore
-rwxr-x--- 1 root root 358 Mar 1 2018 /usr/lib/plesk-9.0/remote_mail_restore/mail_outgoing_restore
The major cause of this error is a failed upgrade.
In order to solve this, follow the below steps:
i. Log in to the server over SSH
ii. Move the files to the other location:
# mv /usr/lib/plesk-9.0/remote_mail_restore/mail_postfix_transport_restore /root/plesksupport/
# mv /usr/lib/plesk-9.0/remote_mail_restore/mail_outgoing_restore /root/plesksupport/
iii. Reinstall latest updates:
# plesk installer update --repatch
b. mchk failed: mailsrv_conf_init… not found
i. Execution of plesk repair mail fails:
# plesk repair mail
Reconfiguring all domains and mailboxes ......................... [2017-09-03 11:17:31] ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/mchk'] with exit code 
- mchk failed: ==> Checking for: mailsrv_conf_init... not found,
ii. Symbolic link /usr/bin/which points not to /bin/which:
# ls -al /usr/bin/which
lrwxrwxrwx 1 root root 63 Aug 24 04:04 /usr/bin/which -> ../local/share/.config/yarn/global/node_modules/which/bin/which
Mail authorization database is empty:
Authentication database contents:
| address |flags| password |
iii. In /var/log/maillog there are records like:
Feb 3 06:59:30 mail plesk_saslauthd: failed mail authenticatication attempt for user 'example' (password len=9)
Feb 3 06:59:30 mail postfix/smtpd: warning: unknown[xxx.xxx.xxx.xxx]: SASL LOGIN authentication failed: authentication failure
Incorrect location of /usr/bin/which is the cause of this error.
In order to resolve this our Support Techs suggest the following steps:
i. Connect to the server via SSH.
ii. Change location of /usr/bin/which:
# unlink /usr/bin/which
# ln -s /bin/which /usr/bin/which
# ls -al /usr/bin/which
lrwxrwxrwx 1 root root 10 Feb 4 04:15 /usr/bin/which -> /bin/which
iii. If the issue persists, reinstall which package:
# rpm -e --nodeps --noscripts which
# yum install which -y
iv. Run plesk repair mail again.