How to remove emails from Qmail spool containing specific string

Sometimes, you may got a bunch of emails stucking in your spool which you wish that you could remove them with the ability of retaining the other emails. In this case, you may follow below steps to remove emails from Qmail spool containing specific string.

 

  1. Download the spool scanning and filtering script from http://www.redwoodsoft.com in server
    # cd /sbin
    # wget http://www.redwoodsoft.com/dru/mailRemove/mailRemove.py
    # chmod +x mailRemove.py
    

     

  2. Create the folder for filtered file storing
    # mkdir /var/qmail/queue/filter

    Namecheap.com
      
  3. Run the script to filtered the emails containing string or keyword. For example: abcforyou
    # qmailctl stop
    # mailRemove.py --real abcforyou
    # qmailctl start

     

  4. Now all emails that contain the string “abcforyou” are filtered into  /var/qmail/queue/filter. Shall you would like to clear them, run the below command
    # rm -Rf  /var/qmail/queue/filter/*

     

     

Facebooktwittergoogle_plusredditpinterestlinkedinmail