procmail
[Top] [All Lists]

Re: Using 'procmail -m ...' (question)

2004-10-28 09:29:53
On Thu, Oct 28, 2004 at 10:29:57AM +0200, Dallman Ross wrote:
On Wed, Oct 27, 2004 at 01:44:42PM -0400, William Park wrote:
How do I use 'procmail -m ...' ? 

Basically, I'm downloading just the headers from POP3 server, and I
would like to use Procmail recipes to test for spam.  Suppose, I have
file 'testforspam.rc' with recipes
    :0
    * ^Subject:.*viagra
    spam

1.  If I pipe a header with "viagra" subject,
    cat ... | procmail -m testforspam.rc
    it matches, and the content will be saved to file 'spam' just like
    normal delivery, and Procmail returns success (0).  Good.

2.  But, if I pipe non-"viagra" header, it falls off the end of recipes.
    Normally, Procmail will deliver it to my system mail box.  But, when
    I tried
    cat ... | procmail -m testforspam.rc
    it returns failure (73) without delivering to my system mail box.

This is the result I want.  But, is this how I use 'procmail -m ...'?

Have you set $DEFAULT anywhere?  Such as inside testforspam.rc?

No, the recipe contains just the above.  With VERBOSE=on, I get (from
memory)
    Folder:  **Bounced**
at the end.

Since my post, I experimented with EXITCODE, and I found that's the key.
Now, I have something like

    EXITCODE=1
    
    :0
    * ...
    { EXITCODE=0 }

    :0
    * EXITCODE ?? 0
    spam
    :0
    /dev/null

E.g., to /dev/null?  Another thing you can do is unset or reset
(to a bogus value) $HOST at the end of your .testforspam.rc .

I use "procmail -m" in the point-n-shoot.sh diagnostics script
that comes in the Virus Snaggers toolset, and I've never seen your
failure code running it.

-- 
William Park <opengeometry(_at_)yahoo(_dot_)ca>
Open Geometry Consulting, Toronto, Canada

____________________________________________________________
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