procmail
[Top] [All Lists]

Re: retrieve a collective-box and distribute to the users

2001-08-24 02:44:02
Don Hammond <procmail(_at_)tradersdata(_dot_)com> writes:
I wrote as an aside to comments re: difficulty routing mail by headers:

| [...] Also, if it were me, I'd make it
| ^Received:.*\<for[   ]+<?\/[^@ ]+(_at_)domain\(_dot_)de, but I tend towards 
| overly anal caution. [...]

Apparently I wasn't anal enough, and forgot that some special effort is
needed for wrapped headers. Borrowing from a past contribution of
Philip's I believe, this appears to work with 0,1, or 2 wrapped lines:

wsplus='[      ]+'    # space and tab
wws='[         ]*($[   ]+)*'  # ditto

* $ ^Received:.*${wws}${wws}${wsplus}for${wsplus}<\/[^@ 
]+(_at_)domain\(_dot_)de

You only need to manually handle continued header lines when they're
embedded in the body of the message.  When matching against the
'top-level' message header, procmail treats as spaces all newlines that
are followed by a space or tab.  To quote the procmail(1) manpage:

       To make `egrepping' of headers more  consistent,  procmail
       concatenates  all continued header fields; but only inter-
       nally.  When delivering the mail, line breaks will  appear
       as before.

No need to use the wss variable unless you're matching against the body.


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail