mailq
(gets the mail queue ID)
The postsuper command
we use this command in 4 scenarios.
So, to delete all emails in the queue, we use this command as:
postsuper -d ALL
to remove all mails in the deferred queue, use command:
postsuper -d ALL deferred
Similarly, we can remove a particular mail from the queue using the command,
postsuper -d mail_id
To remove messages from a particular domain.
mailq | grep domain.com | awk {'print $1'} | xargs -I{} postsuper -d {}