Cleaning Postfix queues
From MyWiki
I found out that PureMessage Postfix qshape is not returning correct numbers or takes long to process queue directory and something low level like this helps to get the correct ones:
# find /opt/pmx6/postfix/var/spool/mqueue/deferred ! -type d | wc -l
And sometimes you didn't have your Postfix set right to ditch all those test emails and it blows away your deferred queue. To clean it run the below as root:
# mailq | tail -n +2 | awk 'BEGIN {RS=""} /@dummy\.com/{print $1}' | tr -d '*!' | postsuper -d - # mailq | tail -n +2 | awk 'BEGIN {RS=""} /@test\.com/{print $1}' | tr -d '*!' | postsuper -d - # mailq | tail -n +2 | awk 'BEGIN {RS=""} /@example\.com/{print $1}' | tr -d '*!' | postsuper -d -
To get numbers of stuck emails:
# mailq | tail -n +2 | awk 'BEGIN {RS=""} {print $NF}'|sort |uniq -d -c
Reference
[1] How To Delete Mails From Or To A Specific Email Address From Your Mail Queue (Postfix)