The exim mail server has a number of command line options including being able to see what’s currently in the mail queue. Last week I looked at how to flush the exim mail queue and in this post look at how to view the exim mail queue.
Command to view the queue
To view the exim mail queue issue the following command:
mailq
OR
exim -bp
If exim is in /usr/sbin and /usr/sbin is not in your path, you’ll need to prefix the command with the full path like so:
/usr/sbin/exim -bp
Example output
The outut from the above commands will look something like so:
4d 1.2K 1Ka6u5-00032Z-Eb <from@example.com> to@example.com 62h 1.2K 1KaRH0-0007QZ-B5 <from@example.com> to@example.com 3h 22K 1KbLHr-0004ev-An <from@example.com> to@example.com
In the above example "from@example.com" is the email address the email is being sent from and to@example.com is the address being sent to. Normally these would be real email addresses but I’ve changed them for the purposes of this post.
The 4d, 62h and 3h values indicate how long the email message has been in the queue: 4 days, 62 hours and 3 hours respectively.
The x.xK values are the message size.
And the 1Ka6u5-00032Z-Eb etc is the message id and is also the filename of the message on disk, which you will find in /var/spool/exim/msglog and /var/spool/exim/input (the directories may vary depending on your Linux/Unix distribution and/or compiled in settings).
Finding the files with the find command
Using the "find" command you could do this to locate all the relevent files:
find /var/spool/exim -name "1Ka6u5-00032Z-Eb*"
which would display something like this:
/var/spool/exim/msglog/1Ka6u5-00032Z-Eb /var/spool/exim/input/1Ka6u5-00032Z-Eb-D /var/spool/exim/input/1Ka6u5-00032Z-Eb-H
Refer also to my post on how to flush the exim mail queue to then flush the mail queue after you’ve had a look at it.