Get the mailids of all email currently in queue:
postqueue -p|egrep “[A-F0-9]{11}”|awk ‘{print $1}’
Get the count of emails in queue:
mailq | tail -n 1
or
postqueue -p|egrep “[A-F0-9]{11}”|awk ‘{print $1}’|wc -l
List all message in queue:
postqueue -p
To flush the mail queue:
postqueue -f
To remove all mails from the queue:
postsuper -d ALL
To remove all mails in the deferred queue:
postsuper -d ALL deferred
To view message content in queue with id xxxxxxxxxxx
postcat -vq xxxxxxxxxxx