Re: [EXIM] looking for particular addresses in headers

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: Nigel Metheringham
Υ/ο: exim-users
Αντικείμενο: Re: [EXIM] looking for particular addresses in headers
On Mon, 12 Jan 1998, Nigel Metheringham wrote:

> Is there any good method for looking up *header* sender/recipients in a
> list of "baddies" other than a series of explicit filter lines, ie
>
> if $header_to:   contains "friend@???" or
>    $header_cc:   contains "friend@???" or
>    $header_from: contains "friend@???"
> then

>
>
> Say I have a list of these losers, I would like to be able to have a
> single if look for any of them (I suppose I could generate monster
> regexps, but thats not nice either).


This sort of thing is complicated by the fact that headers can contain
multiple addresses and the filter language doesn't support vectors and
iteration. (And I *don't* want to make it into Yet Another Programming
Language!)

I suppose a simple extension would be a "contains_any_of" operator, in
which the rhs was a list of things to match, so you have

if $header_to: contains_any_of "friend@???:enemy@???:...."

which would help a bit, but it's hardly simpler than the monster regexp.
You can, of course, do lookups with $header_to as a key, but that may
not in practice be particularly useful.

There is now a $message_headers variable, so you can at least do

if $message_headers contains "friend@???"

to search all of them at once, assuming that finding that string
anywhere in the headers is good enough for you. Or, you could be more
specific, and use

if "$header_to: $header_cc: $header_from:" contains "friend@???"

since the lhs is just another expanded string.


-- 
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714



--
*** Exim information can be found at http://www.exim.org/ ***