Published on : June 30, 2018 by Andy Robert
If you are familiar with cPanel you might know that cPanel uses the famous Exim as MTA. Exim manages the mail queue using Eximstats. Eximstats parses the exim log to produce text and graphical data, i.e. number of sucessful and unsucessful delivery etc etc. From WHM we can analyse the email queue by from “Home » Email » Mail Queue Manager“. The eximstat normally analyse the exim mainlog and syslog files to generate a statistical output.
At times there will be issues when you try to clear the mails through WHM due to the eximstats database having large size. Here we will clears the eximstats database from command-line.
Note: You will need SSH and root access to the server to proceed.
Switch to the eximstats database
Truncate (empty) the tables
Check database integrity
You can access the server as root via ssh. Use PuTTY SSH clietnt or run following command from terminal if you use a linux OS
ssh root@server-ip -p ssh-port
Replace server-ip with your cPanel server IP and port with your SSH port. Default port is 22
Run “mysql” from command line once you log in. You may get result like below.
Once accessing MySQL you need to switch the database to eximstats database. Run following command to do that.
You may get result like below.
Eximstats database has 3 tables named defers, failures, sends and smtp. What we need to do is remove all the contents from all those tables. To do that you need run command “truncate table table_name”
First we need to list the tables in the database. Run command “show tables;” You will get below result:
As you can see the tables are listed in the result. Now we can clear those tables.
Run command “truncate table table_name”
The result will be as following.
You can exit from MySQL by running command “exit”
Now we can check if the database is intact. Just run the command “mysqlcheck -c eximstats”. You will get output like below.
Now we can restart exim by running the command “service exim restart”
That’s it, now you should be able to clear the mail queue from WHM interface without any issues.