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

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Billy Nadeau
Ημερομηνία:  
Προς: Philip Hazel
Υ/ο: exim-users
Αντικείμενο: Re: [Exim] Exim 4.10 system filter: adding multiple headers
Thanks Philip,

I just tried it again, and it works

I now keep a global variable, by first "headers add" initialise it and my
second call return it

On Friday 09 August 2002 09:01 am, you wrote:
> 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.
>


I've actually seen this problem when two of my servers with spam protection
talk to each other. In my system_filter, I put "if first_delivery" to avoid
this, but I'd also like to do outgoing-only. Is is possible from a system
filter?

And the second header I want to add is different; SpamDetails to find out why
messages get trashed (or not) to help me adjust my rules

> 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.