Exim commands to see email queue flush delete

Exim is a great email server that is widely used on Linux servers. Exim commands are often hard to remember, so we decide to help you out with a fine list. It is light-weight, efficient and powerful in dealing with large quantities of emails.

We will provide some useful commands to be able to manage and troubleshoot it via SSH/Shell. You could some software such as Putty or other terminal to get on to the mail server.

Exim commands list

To see a total count of messages in mail queue, you simply type:

root@server# exim -bpc

Listing of all mails in the queue in the format of time in the queue, size of the message, message-id, sender address and recipient address:

root@server# exim -bp

Summary of messages in the queue (count, volume, oldest, newest, domain, and totals):

root@server# exim -bp | exiqsumm

See what the mail server is doing at the moment in terms of processes:

root@server# exiwhat

Remove a single email message from the queue:

root@server# exim -Mrm {message-id}

Remove all messages which are older than 2 days in the pending mail queue:

root@server# exiqgrep -o 172800 -i | xargs exim -Mrm

Remove all messages waiting in the mail queue:

root@server# exim -bp | exiqgrep -i | xargs exim -Mrm

See how your mail server will route a message using recipient:

root@server# exim -bt [email protected]

View a full message header:

root@server# exim -Mvh

View a mail body or content:

root@server# exim -Mvb

If you are seeing large number of pending emails in the mailqueue then it’s most likely the transport isn’t able to handle the load. Otherwise it could be down to poor spam management.

Try installing something like spam assasin or other filtering solution to work with your mail platform. I have had experience with over million mails in the queue due to badly managed whitelisting and not including all the RBL (IP blocklist providers).

You will need to tweak one setting at a time and let it run for at least 24 hours  – 48 hours to see if it’s effective. Doing too many changes in one go could end up preventing flow of emails freely.

You can take a look at the exhaustive list of commands at official site.


Add a Comment