I'm having a great deal of trouble writing a rule to match something in a Received: header. The problem is that sendmail(?) is whitespace wrapping the header. In other words, instead of:

Received: from [192.168.1.31] (mux.example.com [1.2.3.4]) by mail.example.com (8.14.4/8.14.4) with ESMTP id abc1234 (version=TLSv1/SSLv3 cipher=DHE-DSS-CAMELLIA256-SHA bits=256 verify=NO) ...

(i.e. the header is on one line with spaces between items and \n on the end)

I'm getting (if this mailing list doesn't mangle it):

Received: from [192.168.1.31] (mux.example.com [1.2.3.4])
    by mail.example.com(8.14.4/8.14.4) with ESMTP id abc1234
    (version=TLSv1/SSLv3 cipher=DHE-DSS-CAMELLIA256-SHA bits=256 verify=NO)
    ....

(i.e. it's wrapped with continuation lines prefixed with a \t)

Now here's the thing. I'd assumed that a rule testing a header would handle the complete header line, even when wrapped. It doesn't.

In the example, this matches:

header TEST_RULE                Received =~ /mux.example.com/

This doesn't:

header TEST_RULE                Received =~ /ESMTP/

I *really* need to match something on the third line! I tried using \t as the name of the header - a bit desperate and also futile.

Is this feature there by design? Is there a work-around? Do I just not understand the perl regexp well enough? If all else fails, does anyone know how to stop sendmail wrapping the headers, although this isn't a general solution.

Thanks, Frank.





Reply via email to