procmail
[Top] [All Lists]

Re: Using tthe return status of a program to filter

2002-08-23 15:13:29
I'm working on bogofilter, a Bayesian spam filter.

Flavour of the month, it seems.  The one I knocked together works
nicely, so it seems like a very worthwhile exercise.

Suppose I have a utility named bogofilter that tests its standard input and
returns 0 for spam, 1 for nonspam, How do I write a recipe that
directs mail getting a 1 return value to a spam box?

I presume you mean 'getting a 0 return value to a spam box' since
'returns 0 for spam'?

  :0:
  * ? bogofilter
  spam

The '?' flag on a condition line is in the procmailrc man page.  There's
not a lot said about it there though.  There's an example in the
procmailex man page.

If you want to test for the program returning non-zero you can do:

  :0:
  * ! ? bogofilter
  spam

Hope that helps,
Martin
-- 
Martin McCarthy                 /</    http://procmail.non-prophet.org
    `Procmail Companion'        \>\
     Addison Wesley             /</                  PGP key available
_______________________________________________
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>