Clearing the Mail Queue on VPS and Dedicated Servers

Clearing the Queue

Once you have logged into SSH as the root user, you will need to run a few commands to clear the queued mail files and the mail database.

Stopping the Mail System

Before clearing out the queue, it's a good idea to stop the mail system. This will take the mail system offline while you clean it up. Enter the following command to stop the mail service:
service exim stop

Stopping the mail system.

Clearing out the Files

  1. After exim has stopped, enter the following command to clear out the mail files:

    rm -Rf /var/spool/exim/input/*

    Clearing the mail files.Note: This command may take some time to run if you have a large queue. You will not be given any progress indicator. You will know it's finished when the command prompt returns and allows you to type another command.

Clearing out the Database

  1. Enter the following command to remove the mail stats database:
    mysqladmin drop eximstats;
    When prompted to confirm, type y.

    Dropping the the eximstats database.
  2. Enter this command to create the mail stats database again: mysqladmin create eximstats;

    Recreating the eximstats database.
  3. Finally, enter this command to restructure the database:
    mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql

Clearing out the Log

Clearing out the log will lower the file count, which may have spiked as a result of the excessively large mail queue. This is important because keeping your file count down will help your server perform better.

  1. Enter the following command to clear out the log:
    rm -rf /var/spool/exim/msglog/*

Restart The Mail system

Enter the following command to start the mail system again. 
service exim restart

 

 

Starting the mail system.

Once the mail system has started you are finished clearing the queue.

 
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

421 Unexpected failure

If you are trying to send emails and get a message like: 421, response: Unexpected failure,...

451 error while writing spool file

This message indicates that your email is not configured properly. Please double check you are...

535 Incorrect authentication data

If you have a Linux dedicated server, you can fix this problem. In root WHM, go to Email >...

550 error

This error indicates an inability to send emails. There are many reasons for a 550 error. 550...

Are you able to receive emails but not send?

If you aren't able to send this usually means one thing... your internet provider is blocking...