Re: [Exim] Exim 4.10 system filter: adding multiple headers

Pàgina inicial
Delete this message
Reply to this message
Autor: Philip Hazel
Data:  
A: Billy Nadeau
CC: exim-users
Assumpte: Re: [Exim] Exim 4.10 system filter: adding multiple headers
On Fri, 9 Aug 2002, Billy Nadeau wrote:

> I tried calling headers add twice, without success. As before, both headers
> are added but the $h_ variable isn't available


It is when I try it.

Ah, I see where your problem is. You have

${if >={$h_X-SpamLevel:}{100}{yes}{no}}

But if you have added two headers, say

X-SpamLevel: 100
X-SpamLevel: 99

then the value of $h_X-SpamLevel: will be "100\n99", that is, the
concatenation of the two headers with a newline character in between.

You can probably do what you want with a sufficiently cunning regular
expression. Assuming you don't use stupid numbers like "000", something
like this (untested) might work:

${if match {$h_X-SpamLevel}{\N(?:^|\n)\d{3}\N}{yes}{no}}

It looks for a sequence of 3 digits at the start or following a newline.
That's Exim 4 syntax. For Exim 3, remove the "\N"s and insert \ before
every \ { and } inside the regex.

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.