Linux : How to manage Exim mail queue

By | June 1, 2019

Here are some useful commands to manage the Exim mail server queue.

Show the mail queue content :

exim -bp

Show the amount of mail in the queue :

exim -bpc

Delete a specific message in the queue, with the help of the first command in this example (exim -bp) to get the message ID :

exim -Mrm <message_id>

Example :

root@hostname [~]# exim -bp

15m  250K 1hBV44-0001iY-Hl <sender@domain.tld> *** frozen ***
          receipient@domain.tld

root@hostname [~]# exim -Mrm 1hBV44-0001iY-Hl
Message 1hBV44-0001iY-Hl has been removed

Delete the full content of the mail queue :

There are some circumstances where you may want to need to flush the entire mail server (Exim) queue – infected computers/users are common these days and a situation may easily degenerate when the queue hit an unmanageable amount of mails. if you get to that point, the following command will flush absolutely ALL emails in the queue :

exiqgrep -i | xargs exim -Mrm