CentOS, Plesk, and Postfix — How to view the mail queue and its messages

Need to view the mail queue on a plesk box running postfix?

# mailq

mailq is a very simple command that will show the messages awaiting delivery.

# /usr/local/psa/admin/sbin/mailqueuemng

Yet another helpful command to view more information on the emails in the queue.

From this command you will receive a random id before the mail information is given.

Example:

70BA7D281EC (7, D)

  Return-path: Sender <from@domain.com>

  From: Sender <from@domain.com>

  To: Receiver <to@domain.com>

  Subject: The Email Subject

  Date: Tue, 29 May 2012 11:24:48 -0400

  Size: 5458

  Message-Id:

Timestamp: 1338305091

  Queue time: 1338305091

  Envelope Recipients (D): to@domain.com

You would use this id to view the email directly by going to:

# cat /var/spool/postfix/deferred/7/70BA7D281EC

Notice the /7/ folder.  This will vary depending on the beginning number or letter of the id.  By using the cat command, it will print the email on the screen in the terminal.

Furthermore, you can watch what emails are being sent and receiving by viewing the maillog.

# tail -f /usr/local/psa/var/log/maillog

Leave a comment