Show the sendmail mail queue

To check what is currently sitting in the sendmail mail queue use the sendmail -bp command or its alias mailq. This post looks at basic usage of this command and the output from viewing the mail queue.

To list the mail queue in sendmail do this:

sendmail -bp

or this:


Depending on the settings on your server you will probably need to run the above commands either as root or using the sudo command. You may also need to type the full path to sendmail which for example is /usr/sbin/sendmail on a CentOS or Red Hat Enterprise Linux setup.

This will give you example output like this:

                /var/spool/mqueue (3 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
m9TMLQHG012749     1103 Thu Oct 30 11:21 <apache@localhost.localdomain>
                 (host map: lookup ( deferred)
m9TMLRB9012751    37113 Thu Oct 30 11:21 <apache@localhost.localdomain>
                 (host map: lookup ( deferred)
m9TMLPcg012747   240451 Thu Oct 30 11:21 <apache@localhost.localdomain>
                 (host map: lookup ( deferred)
                Total requests: 3

The above example shows that there are currently 3 messages in the mail queue and that they have all been deferred, meaning delivery will be attempted again at a later time.

If the queue was empty you would simply get this:

/var/spool/mqueue is empty
                Total requests: 0