procmail
[Top] [All Lists]

procmail newbie seeks help

1997-05-29 03:33:00
OK.  In my rc file I've got one rule that searches for certain key phrases
that spammers like to use and sends them to a special folder.  I'd like to
minimize the chances that genuine mail makes it into that folder, so this
rule is after all my other rules, etc. etc.

I had another idea as an additional safety that I really liked.  I wanted
to check the from: line on all the incoming mail against all the addresses
in my pine .addressbook.  I hacked out a quick C++ program that does just
that.  The program recieves the from line as the MAILFROM environmental
variable, parses the .addressbook file, exits with a -1 if there is no
match, or returns 0 if there is a match.  Here is what I put in my rc file

:0 cfw
{MAILFROM='formail -x From:' | doIknowyou}

       :0 afw
       | formail -a "X-I-Know-This-Person: Yes"

and then later on I could have:

:0 HB:
* !.*X-I-Know-This-Person: Yes
* once-in-a-lifetime|bad credit or no credit|opportunity
available|savetree|make
 money with your computer|skeptical at first|long distance service|loads of
mone
y|free money|this is for real|no risk|this is a one time mailing|for adults
only
|please read this twice|email blaster
|formail -a "X-Status: D" >> spam

(the weird wrapping here was done by pine, you get the point though...)

OK... I know that the part of the system that sends the mail to the
doIknowyou program is wrong though.  I'm not sure how to fix it, as I am
new to procmail and find the man pages very confusing!  I'm reluctant to go
experimenting with something I don't totally understand because I'm afraid
my mail will get sucked into a black hole.

The doIknowyou program does not filter the mail itself... if you pipe the
mail to it it won't spit it out again.  I don't want to screw with the mail
itself at all for fear of messing it up.  It simply gets the From: line
from the environmental variable (did I do that right?) and returns a 0 or a
-1.

Is this doable?  Is there a better way of doing it?

Thanks in advance!

--=-=-=-=-=-=-=-=-=
Barry J. Bocaner
<barry(_at_)gslink(_dot_)com>
-=-=-=-=-=-=-=-=-=-

<Prev in Thread] Current Thread [Next in Thread>