hi Michelle,
Thanks - and Im now looking at your website with the various
scripts/recipes..
Rgds
ernest
Michelle Konzack wrote the following on 04/29/2005 02:28 PM:
Am 2005-04-29 13:55:07, schrieb Ernest Byaruhanga:
Hi all,
I am trying to implement a filter based on keywords on the body of
the email.
Basically this is what i want to do:
Keywords: WORD1, WORD2, WORD3, KEYWORD5, BOB
My filter should see if the content of all email to john(_at_)example(_dot_)com
contains:
WORD1 or WORD2 or WORD3 or KEYWORD5 or BOB, and then deliver the
good mail to john(_at_)example(_dot_)com(_dot_) Otherwise, the email missing any of
the above keywords should go to the "spam" mailbox.
Has anyone does this before? I am a procmail newbie and am trying
not to re-invent the wheel :-)
Yes me, but only in a BASH script becasue I am not a procmail Geek
__( example )_______________________________________________
#!/bin/bash
cat /dev/stdin >tmpfile
KEYWORDFILE=/path/to/key_word_file
NUM=`cat $KEYWORDFILE |wc --words`
let RETVAL=0
for KEYWORD in `cat $KEYWORDFILEkey_word_file` ; do
grep $KEYWORD tmpfile >/dev/null 2>&1
if [ $? == "0" ] ; then let RETVAL=RETVAL+1 ; fi
done
if [ $RETVAL -lt $NUM ] ; then
exit 1
else
exit 0
fi
____________________________________________________________
and use the "Exit Status" to determiner the Delivery status.
Any reply will be greatly appreciated.
regards,
ernest
Greetings
Michelle
____________________________________________________________
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