Posted By

Figjam on 08/04/09


Tagged


Versions (?)

Sendmail: Delete Matching Mail


 / Published in: Bash
 

Delete emails matching a phrase in the headers.

  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  

You need to login to post a comment.