procmail
[Top] [All Lists]

Re: Running a script from procmail

2006-09-30 17:03:02
On Sat, Sep 30, 2006 at 01:56:46PM -0700, Professional Software
Engineering wrote:


REALLY simplify and speed things up (since you're making use of fewer 
processes):

:0:
* ^X-Original-To:[      ]*\/[^  ]*(_at_)mydomain\(_dot_)tld
* MATCH ?? ^\/[^(_at_)]+
* $? fgrep -x -i "$MATCH" $RCPT_BLACKLIST
blacklist

Note that I started composing this before I saw Dallman's
most recent contribution (which also suggests eliminating the
formail/awk).  This remains an improvement over his very similar
method because there's no need to pipe the match string from echo
into formail, and this also brings in the outer domain condition.
Short of setting RCPT_BLACKLIST, the recipe above is the ENTIRETY
of the recipe you need.

What pipe to formail?  I had this:

    :0
    * ^X-Original-To: \/[^(_at_)]+
    * $? echo $MATCH | fgrep -i -x -f $RCPT_BLACKLIST
    blacklist

(I should have used a lockfile.)

Okay, you mean pipe to fgrep instead of just running fgrep.
Btw, works fine without the $ expander in the condition line.

As for the domain in the X-Original-To:, well, he already
said the only mail hitting this recipe was mail destined for
users on his domain.  Moreover, the X-Original-To: is added
by the local server, so if there's one space, there's one
space; no need for fancy checks for more or less whitespace.
That's why I coded mine that way.

On mail coming through other servers, we can't trust the
whitespace by definition.  On our own server, i.e., what
it adds, we can.

Dallman

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