This small shell script removes all messages originating from a certain sender address out of the postfix mail queue.
#! /bin/bash
if [ "$1" == "" ]; then
echo "please give e-mail address"
exit 1
else
emailaddr=$1
fi
for id in `mailq | egrep "[0-9A-F]{10} " | grep "$emailaddr" | cut -d " " -f 1`
do
echo $id
postsuper -d $id
done
![](/blog/themes/modern/images/box_add.png)
![$star_image](themes/modern/images/stars/full_star.png)
![$star_image](themes/modern/images/stars/full_star.png)
![$star_image](themes/modern/images/stars/full_star.png)
![$star_image](themes/modern/images/stars/no_star.png)
![$star_image](themes/modern/images/stars/no_star.png)