Clearing the Mail Queue on VPS and Dedicated Servers Print

  • 0

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.

 

Was this answer helpful?

« Back