I try to delete some special mails from Postifx Queue. I want to Filter with "Mail From" and Mail Domain "TO".
I have tried:
mailq|grep 'info@sendingdomain.com'|awk '/ @test\.com$/ { print $1 }' | tr -d '*!' | postsuper -d -
But it don't work.
You can use this bunch of code
#!/bin/bash
[ ! -n "$1" ] && echo "Usage : $0 mail" && exit 1
for mail in $( mailq|egrep '^[A-Z0-9]'|grep "$1"|awk '{print $1}'|sed 's/^\([0-9A-Z]*\).*$/\1/' )
do
/usr/sbin/postsuper -d $mail
done