Contents

How to Clean the Mail Queue in Exim

03 Mar 2018 0 60  0
How to Clean the Mail Queue in Exim
How to Clean the Mail Queue in Exim

 

Exim is a free and versatile mail transfer agent (MTA) which was ported to many Unix-like systems and is the default for several Linux distributions, the most common of which is the Debian Linux distribution. Exim is used across the globe with around 56% of the publicly available servers on the internet using it as their mail transfer agent.

In the following tutorial, we are going to teach you how to clean the mail queue in Exim.

Checking Exim’s Mail Queue

Before we begin, we are going check if there are any particular messages that we’d like to delete, execute the command below.

# exim -bp

This command should present a list of every message in the queue along with their respective message id.

A message returned by this command will look like the one below.

18h 2.1K 1dMX7a-0001rT-I2 <> *** frozen ***

         [email protected]

If you want to remove a message in Exim, use the following command.

# exim -Mrm <message-id>

If you would like to remove the message in the example above, you can execute the following command.

# exim -Mrm 1dMX7a-0001rT-I2

Clearing Exim’s Mail Queue

If you have several messages in your mail queue which were generated by a spam script and you would like to get rid of them without sending any messages, then this can be done as shown below.

# exim -bp | exiqgrep -i | xargs exim -Mrm

As with the first command, the first part of the command ‘Exim – bp’ lists every message we have in the mail queue, the second command ‘exiqgrep –I’ retrieves only the message ids from the first command, and the third command ‘xargs exim –Mrm’ passes the message ids returned from the second command to the command ‘exim –Mrm’ which, in turn, deletes the messages from the queue.

You may find that you have mail in the queue which is legitimate but that the mail server was not able to send due several reasons. It is possible to force the mail server to send this mail once the problem has been fixed; this can be done by executing the following command.

# exim -qff

This should force Exim to send every message in the mail queue, regardless of whether it is frozen.

These are all of the things you should need to clean your mail queue completely.

0 Comments
Add a comment

Leave a Reply