There are several scripts to do that, but I found most of them are not clearing the active queued messages as the mail ids contain '*' at the end of the ID field. I have used cut -n to get the exact mail ID and delete them.
Following given command will delete mails from/to 'testuser@test.com' from the queue:
postqueue -p | grep "testuser@test.com" | cut -f 1 -d ' ' | cut -c-10 | xargs -n 1 postsuper -d
Following referrences are worth to read:
http://www.postfix.org/postsuper.1.html
http://www.bstar.de/2014/07/08/how-delete-single-mails-from-the-mail-queue-of-postfix-plesk/
Following given command will delete mails from/to 'testuser@test.com' from the queue:
postqueue -p | grep "testuser@test.com" | cut -f 1 -d ' ' | cut -c-10 | xargs -n 1 postsuper -d
Following referrences are worth to read:
http://www.postfix.org/postsuper.1.html
http://www.bstar.de/2014/07/08/how-delete-single-mails-from-the-mail-queue-of-postfix-plesk/