procmail
[Top] [All Lists]

Re: Running a script from procmail

2006-09-29 22:42:53
Professional Software Engineering wrote:
:0
* $? formail -x"To:" -x"Cc:" | fgrep -i -w -f $BLACKLIST
{
         # we matched something
         :0fwh
         | formail -A"X-YourCustomHeader: somevalue"
}


Well, this seems to work.

- The fudging with awk is because I only keep a list of the user part of 
the addresses (as they're all to my own domain).

- I've done some tests too, and the X-Original-To header is always 
written even if it's for multiple recipients, so that's handy too!

- There is a possible slight anomoly in the log... (see after recipe), 
that makes me wonder if/how/why it might be testing the same condition 
twice.

:0
* ^X-Original-To: (_dot_)*(_at_)mydomain(_dot_)com
{
         :0
         * $? formail -x"X-Original-To:" | \
                 awk -F@ '{sub(/ /,\"\");print \$1}' | \
                 fgrep -i -x -f $RCPT_BLACKLIST
         blacklist
}

--- LOG (sorry for the long lines)

procmail: Match on "^X-Original-To: (_dot_)*(_at_)mydomain(_dot_)com"
procmail: Executing " formail -xX-Original-To: | awk -F@ '{sub(/ 
/,"");print $1}' | fgrep -i -x -f /home/username/.procmail/rcpt_blacklist"
procmail: Non-zero exitcode (1) from " formail -xX-Original-To: | awk 
-F@ '{sub(/ /,"");print $1}' | fgrep -i -x -f 
/home/username/.procmail/rcpt_blacklist"
procmail: No match on " formail -xX-Original-To: | awk -F@ '{sub(/ 
/,"");print $1}' | fgrep -i -x -f /home/username/.procmail/rcpt_blacklist"
procmail: Bypassed locking "/var/mail/username.lock"
"

Regards,
Steve :)


____________________________________________________________
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

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