procmail
[Top] [All Lists]

Re: Help on simple spam filter

2001-03-05 21:40:31
Homer Wilson Smith <homer(_at_)lightlink(_dot_)com> writes:
   I wish to build a simple spam filter consisting of a single sh, perl
or C program that receives all mail coming into our system for all users,
and decides on its own internal criteria,

   1.) Deliver the mail to /var/spool/mail/$USER
   2.) Deliver the mail to /var/spool/spam/$USER
   3.) Deliver the mail to /dev/nul

   Would someone please quickly explain how this script is called in
/etc/procmailrc?  I would like to avoid having the shell script do the
delivery of the mail itself, but wish to pass the mail back to procmail
for final delivery.

Okay, you need to decide how to pass the information from the script
back to procmail.  The two easiest are the script's exitcode and for
the script to output some word that procmail then interprets to select
the correct mailbox.  I recomend the later as it lets non-zero exitcodes
continue to exit real problems: you don't want the failure of the script
to run because, for example, the system process table is full, to mean
anything besides "deliver to the normal spool".  ("First do no harm")
Okay, let's say that if the program spits out something starting with
"toss" then the message should be delivered to /dev/null.  Otherwise,
if it returns something beginning with "spam" then it should be delivered
to the parallel spam directory.  Otherwise it goes to the normal spool:

        :0 w
        WHERETO=|spamprogram

        :0
        * WHERETO ?? ^^toss
        /dev/null

        :0
        * WHERETO ?? ^^spam
        { DEFAULT = "/var/spool/spam/$LOGNAME" }

(Note: the variable containing the username of this recipient is LOGNAME,
not USER.)


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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