Quick script to delete matching emails in sendmail queue. Really usefull when an account has been hacked and you have thounsands of spam emails in the queue.
#!/bin/sh
cd /var/spool/mqueue
for i in `grep -sl "
do
j=`ls -1 "$i" | sed 's/qf\(.*\)$/df\1/'`
echo "Deleting $i ($j)"
rm $i $j
done