procmail
[Top] [All Lists]

Re: procmailrc script fine tuning

2006-04-25 04:15:24
David W. Tamkin wrote:
LDB wrote:

#!/bin/bash

You are hash-banging bash, but you have two recipes in procmail syntax 
there, plus assignments of several variables that are special to 
procmail (and which I am sure you mean in those senses) but just 
ordinary to bash.

You should be hash-banging procmail instead, with the -m flag so that 
all positional parameters are passed ...

 #!/usr/local/bin/procmail -m

(or whatever your path to procmail is).

LOGFILE=/var/log/procmail.log
LOGABSTRACT=all
VERBOSE=yes

SENDER=$1
SPAMCATCH=spam-admin(_at_)freestandards(_dot_)org
SHIFT=1

# Until now, mail is untagged, you may add rules for
# mail that must not be tagged

:0 hbfw
| /usr/bin/spamc

The pair `hb´ is the default and can be omitted.

# Now mail is tagged by spamassassin
# You may insert other rules here

:0
| /usr/sbin/sendmail -i -f "$SENDER" -- "$@"

 :0
 ! -i -f "$SENDER" -- "$@"

as the action, and I'm not sure about the -i (I don't remember what it 
does; did you mean -oi?).

The above script was created by SuSE and I am to use to capture and 
filter spam
back to the user re-labled with SPAM headers. My problem is that I 
want all
captured TRUE SPAM to be redirected to $SPAMCATCH and not $SENDER. If 
it is not
SPAM, then it should go to the user as normal.

Spent all this time with your syntax, and here you have a SpamAssassin 
question which (for lack of any experience with SA) I can't answer 
anyway!  Clearly you'll need some test for the exit code or filter 
output of spamc, and perhaps an A or E flag on the closing recipe (the 
one that passes the message to the MTA).



I am not sure why I put #!/bin/bash up when all it is is a /etc/procmailrc and 
I 
do not have that in original script.

You can probably ignore the spam assassin piece and pretend it is something 
else.

Can procmail do if-then-else type statements? From what I have read .. no, but 
it is nice to check.

Thanks.

LDB

____________________________________________________________
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