Sendmail: Delete Matching Mail


/ Published in: Bash
Save to your folder(s)

Delete emails matching a phrase in the headers.


Copy this code and paste it in your HTML
  1. #!/bin/sh
  2.  
  3. cd /var/spool/mqueue
  4. for i in `grep -sl "<some common phrase in the headers>" qf*`
  5. do
  6. j=`ls -1 "$i" | sed 's/qf\(.*\)$/df\1/'`
  7. echo "Deleting $i ($j)"
  8. rm $i $j
  9. done

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.