procmail
[Top] [All Lists]

Re: Multiline Received header not being matched

2004-02-13 10:42:05
On Fri, Feb 13, 2004 at 09:30:45AM -0500, David Stone wrote:

Due to a recent software/configuration change, my local mail server
is splitting the Received: header over several lines.  The procmail
docs say this shouldn't be a problem since procmail will match any
Header: even if it is split in this way.

Unfortunately in my case, this does not appear to be true.

Here are some example recipes that don't work.  They both result
in a "no match on ..." entry in the log file:

:0f
* ^Received: from.* \(\[[0-9]+.* by example\.com
| formail -A "X-SpamTest: Sending MTA has no rDNS"

:0f
* ^Received: from.* \(\[[0-9]+(.*$)[  ]+by example\.com
| formail -A "X-SpamTest: Sending MTA has no rDNS"

The problem is not what you think you've diagnosed.  Procmail
is having no trouble concattenating the Received header.
Rather, the problem is with your conditions.  In the first,
you specify a space before the word "by"; but the Received
header, wrapped, uses a tab there.  Procmail unwraps the line,
but leaves the tabs intact.  You need to use something like

   # space and tab in the brackets
   .*[  ]by example\.com

Or put the space and tab in vars for easy distinguishment
when eyeballing:

  TAB = "       "
  SPACE = " "
  WS = "$TAB$SPACE"

  * ^Received:[$WS]*from.*[$WS]\(\[[0-9]+.*[$WS]by example\.com


The second recipe's condition fails because of the "$": there
is no end-of-line, since procmail has concattenated the Received.

-- 
dman

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