procmail
[Top] [All Lists]

Re: How to filter aldready delivered email

2004-12-09 01:16:49
  ____( stdin )_________________________________________________________
 /
| #!/bin/bash
| | RET_SENDER=`cat $1 |formail -c -x Sender:`
| echo $RET_SENDER |grep "thelist-list-bounces(_at_)list(_dot_)com" /dev/null 
2>&1
| ES=$?
| if [ $ES == 0 ] ; then
|   mv $1 $HOME/Maildir/.thelist/cur/
| fi
 \______________________________________________________________________

That variable "ES" above never got set when I tried. I changed the script a little bit like this and now it works:

#!/bin/bash

HEADER_RET=`cat $1 | formail -c -x Sender:`
if [ "`echo $HEADER_RET | grep "thelist1-bounces(_at_)list(_dot_)com"`" ]; then
        FILTER_DIR=".thelist1"
        mv $1 $HOME/Maildir/$FILTER_DIR/cur/
        echo "Mail filtered to $FILTER_DIR"
        exit 0
fi

[...]

HEADER_RET=`cat $1 | formail -c -x Sender:`
if [ "`echo $HEADER_RET | grep "thelist2-bounces(_at_)list(_dot_)com"`" ]; then
        FILTER_DIR=".thelist2"
        mv $1 $HOME/Maildir/$FILTER_DIR/cur/
        echo "Mail filtered to $FILTER_DIR"
        exit 0
fi

echo "Mail not filtered."

Best regards,
Jan

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail