On Tue, Sep 27, 2005 at 01:21:04PM +0200, Dallman Ross wrote:
Btw, one can use the order to construct a procmail-only (no formail)
preferential-address parser. I learned this trick from procmail
master Rik Kabel about six years ago, off-list, when my procmail-fu
was much, much less. He hasn't posted here in a long, long time,
unfortunately. Whitespace that follows carets Inside square
brackets below comprises a space and a tab.
:0
* ! ^Reply-To:.*\/[^ ]+(_at_)[^ ]+[.][a-z][a-z]+
* ! ^From:.*\/[^ ]+(_at_)[^ ]+[.][a-z][a-z]+
* ! ^Sender:.*\/[^ ]+(_at_)[^ ]+[.][a-z][a-z]+
* ! ^Return-Path:.*\/[^ ]+(_at_)[^ ]+[.][a-z][a-z]+
* ! ^^From .*\/[^ ]+(_at_)[^ ]+[.][a-z][a-z]+
{ }
:0 E
{ REPLY_TO = $MATCH }
1:09pm [~/Mail] 581[0]> sh -c "procmail -m DEFAULT=/dev/null \
VERBOSE=y rt.rc 2>&1" < headertest | grep Y_T
procmail: Assigning "REPLY_TO=<dman+from(_at_)nomotek(_dot_)com"
^
|
/
/
My regex needs work to keep that '<' out, among other
non-address chars such as '(' that could anchor an address.
While in my own procmail code I am entirely compulsive about
the regex - which has the side effect that it's ugly - we
can eliminate this common problem with less rigorous changes.
for example:
ADDR_PARSER = '.*\/[^ ]+(_at_)[^ ]+[.][a-z][a-z]+'
can be changed to:
ADDR_PARSER = '.*\/[^[(<" ]+(_at_)[^ ]+[.][a-z][a-z]+'
:0
* $ ! ^Reply-To:$ADDR_PARSER
* $ ! ^From:$ADDR_PARSER
* $ ! ^Sender:$ADDR_PARSER
* $ ! ^Return-Path:$ADDR_PARSER
* $ ! ^^From $ADDR_PARSER
{ }
: E
{ REPLY_TO = $MATCH }
--
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