This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here

Skip to main content

Just Host Web Hosting Help

Clearing the Mail Queue on VPS and Dedicated Servers

Overview

This article will explain how to clear the outbound mail queue on a dedicated or VPS server.


Click on any of these sections to jump to that point in the guide.


What You Need

  • The password for the root user on your server.
  • An SSH client like Terminal (Mac, Linux) or Putty (Windows).
  • A domain name that points to your server or your servers IP address.

Login through SSH

These instructions require knowing the root password for your server. If you don't know the root password or haven't set one up, please see https://my.Justhost.com/hosting/help/whm-login#root-password.

Using Terminal (Mac, Linux)

  1. Open Terminal
  2. Type the following command to login into your server through SSH:
    ssh root@exampledomain.com
    Note: Replace exampledomain.com with your domain or IP address.
  3. If you receive a message about the authenticity of the host, type yes to continue connecting.
  4. When it asks for your password, enter the root password to your server.
    Note: It's normal not to see anything on the screen change as you enter your password.

Using Putty (Windows)

To make an SSH connection on Windows, you must have a compatible SSH client such as putty. You can download putty from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html.

  1. Open Putty
  2. Enter your domain or IP address as the hostname.
  3. Enter 22 for the port number.
  4. Protocol should be set to SSH.
  5. Click the Open button.
  6. If you receive a message about the authenticity of the host, type yes to continue connecting.
  7. When it asks for the username, type: root
  8. When it asks for the password, enter the password for the root user. Note: It's normal not to see anything on the screen change as you enter your password.

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.
Stopping the mail system.

Clearing out the Files

  1. After exim has stopped, enter the following command to clear out the mail files:
    exim -bp | awk '{print $3}' | xargs exim -Mrm - removing *
    Note: This command may take some time to run if you have a large queue. You will not be given any progress indicator but will see a list of the messages as they are being removed. You will know it's finished when the command prompt returns.

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.
    Dropping the the eximstats database.
  2. Enter this command to create the mail stats database again: mysqladmin create eximstats;
    Recreating the eximstats database.
    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.
Starting the mail system.

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

Knowledgebase Article 147,976 views bookmark tags: dedi dedicated mail queue vps


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

This article will explain how to view the email logs on a Dedicated or VPS server. This may be usefull if you are experiencing trouble with your email.
Knowledgebase Article 147,973 views tags: dedi dedicated logs mail vps whm

This article will explain how to restart the email related services on a Dedicated or VPS server. This may be useful if you are experiencing trouble with your email.
Knowledgebase Article 143,792 views tags: dedi dedicated dovecot exim mail restart vps whm

This article will explain how to view the outgoing email queue or exim queue in SSH.
Knowledgebase Article 106,057 views tags: dedicated exim ssh vps

Related Help Content

This article will explain some common causes for 500 errors on Dedicated or V.P.S servers.
Knowledgebase Article 129,829 views tags: dedi dedicated error server vps

This article will explain how-to enable FTP on a newly provisioned VPS or Dedicated cPanel server. Since FTP is an unsecured connection point to the server, cPanel has it disabled by default in version 11.86 or prior.
Knowledgebase Article 45,992 views tags: dedicated file ftp root server transfer vps

This article will explain how to create and manage users on Dedicated or VPS servers.
Knowledgebase Article 140,825 views tags: dedi dedicated users vps

This article will explain how to configure your dedicated or VPS server to use the new (non legacy) backup system.
Knowledgebase Article 112,592 views tags: backup dedi dedicated vps

VPS and Dedicated servers come with all applications necessary to run a standard web and email server. The applications that come with the VPS and Dedicated servers are generally supported as-is by our support technicians.

How to setup name servers for multiple cPanel accounts.
Knowledgebase Article 280,734 views tags: accounts custom dedicated multi multiple nameservers server servers

This article will explain how to disable SSLv3 on a VPS or Dedicated server. This can help you avoid issues with vulnerabilities in SSLv3.
Knowledgebase Article 120,842 views tags: dedi dedicated ssl vps

This article will explain how to restart your Dedicated or VPS server.
Knowledgebase Article 130,086 views tags: dedi dedicated reboot restart services vps

** Google ad credits are only available to customers in the United States, Canada, and the United Kingdom at this time.

¹ VAT (Value Added Tax) is not included in our advertised price and will be charged separately and itemized on invoices and billing information. Standard VAT rates based on EU Member State regulations may apply. Learn more.