Networking HowTos
Networking HowTos

View the Postfix mail queue

April 5, 2012 Linux

If you are having issues sending emails with the Postfix SMTP server, the two best places to look to diagnose the issue, are the log files, and the mail queues.
Any emails that don’t get sent successfully, or that haven’t been sent yet, will be stored in the queue waiting for transmission/re-transmission.
To view the Postfix mail queue, you can use the following command:

postqueue -p

-p = Produce a traditional sendmail-style queue listing.
After the Queue ID field in the output from the above command, there may appear on optional identifier that will tell you if the email is in the ‘active’ queue, or the ‘hold queue’. One of the two examples below contains the * identifier.

* = The message is in the active queue, i.e. the message is selected for delivery.
! = The message is in the hold queue, i.e. no further delivery attempt will be made until the mail is taken off hold.

Example outputs:

 postqueue -p
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
CE20DF0282     2333 Wed Apr  4 16:29:58  sender@sourcedomainname.local
(connect to mail.destinationdomainname.local[aaa.bbb.ccc.ddd]:25: Connection timed out)
                                         recipient@destinationdomainname.local
-- 2 Kbytes in 1 Request.

and

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
EC753D0D00*     328 Thu Apr  5 14:34:09  sender@sourcedomainname.local
                                         recipient@destinationdomainname.local
-- 0 Kbytes in 1 Request.

To flush the queue and attempt to send/resend any outstanding emails, use the “postqueue -f” command which is outlined in more detail in the article titled “Flush the Postfix mail queue to force retry“.

You Might Also Like

  • Tshering Dhendup December 14, 2012 at 3:31 pm

    Dear Admin,
    Thanks for the information. Well do you have a specific command to see the postfix mail transcation from a particular email address to another email address ( for any date/for the past date, etc?)
    Thanks

    • admin December 19, 2012 at 9:04 pm

      Hi,
      The only way I am aware of being able to do this is via the postfix log file. These are generally saved as /var/log/mail.log.
      There might be another way to do what you want, but I’m not aware of it. If you do find a way, please let us know.
      Cheers.