procmail
[Top] [All Lists]

Re: Help on simple spam filter

2001-03-06 20:14:26
At 19:18 2001-03-06 -0500, Homer Wilson Smith wrote:

    I guess what I don't understand is procmail has a copy
of the mail and hands it off to a script like formmail above,
how does procmail replace the copy it has with the new copy
generated by formmail above?

The 'f' flag, which says to treat the program as a filter - thus, procmail is taking the output of the program and making that the new message content. Think of a filter just like a camera lens filter -- something goes in, and it passes something else out. Nevermind that the thing providing the data is the same thing using the data at the back end.

    Also various items like :0 f and w etc are given very
skimpy data in the man pages, makes it hard to really grasp things
like whats the difference with calling a script without the fw and
with it.

f and w seem to be pretty concise, at least to programmer-types, for whom much of procmail is intended (condition rules, regular expressions, etc).

f = filter, thus:

(data from procmail) | filter | (data back into procmail)

In the example which Philip presented, the formail program is handed a copy of the message, which it parses, locates the Subject header, and REPLACES it with the Subject given, then emits the rest of the message, meaning procmail now has a changed message onhand, to continue processing with.

w = wait for program to complete, and if the exitcode is successful (=0, aka "no error condition"), consider it to be filtered/delivered, otherwise, consider it to not have been. If your program returns an error, procmail won't simply replace the message with a copy of the error message which may or may not be emitted by your program (which is probably NOT what you want to happen). It is an OPTION, so if you DO want messages to be considered filtered reguardless of the return code of the filter, you omit this flag.

    Is there a 'bat book' for procmail :)

I believe ORA may have a book on procmail. At least there was some indication that they were going to make one at one point. Beware though, just as with the Bat book (Sendmail) and the Cricket book (DNS), the tool on which the book would be based undergoes frequent revision, so by the time the print publication hits the street, it differs from the actual program in use, at least a little.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

_______________________________________________
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>