delete from the mailq

shuttlebox shuttlebox at GMAIL.COM
Sat Dec 17 09:48:02 GMT 2005


    [ The following text is in the "ISO-8859-1" character set. ]
    [ Your display is set for the "US-ASCII" character set.  ]
    [ Some characters may be displayed incorrectly. ]

On 12/17/05, Jan Agermose <ja at conviator.com> wrote:

      Does anyone have a script or something to delete mails in
      queue based on a regex? Or passing a mail address as sender
      or receiver address?

This is from http://www.brandonhutchinson.com/deleting_mail_queue.html, I
use it myself. He has some more advanced stuff to but this one works
great.

#!/bin/sh

if [ -z $@ ] ; then
   echo "Usage: $0 email_address"
   exit 1
fi

for i in `(cd /var/spool/mqueue; grep -l "To:.*$1" qf* | cut -c3-)`
do
   mv /var/spool/mqueue/*$i /tmp/mqueue
done

/Peter

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki (http://wiki.mailscanner.info/)
and the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

Support MailScanner development - buy the book off the website!




More information about the MailScanner mailing list