A recent botnet attack on a site I manage createded a massive amount of emails in the mail queue.
Before the email system was brought back up, I had to clear them from the queue.
The following little bash script does the trick.
#!/bin/bash
QIDS="$(mailq | grep -B1 'emaildomaintowipe.com' | awk '{print $1}' |grep -v emaildomaintowipe|grep -v '-')"
for q in $QIDS
do
postsuper -d $q
done