Re: [Exim] effective use of .forward files

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: scott
CC: exim-users
Sujet: Re: [Exim] effective use of .forward files
On Thu, 2 Aug 2001 scott@??? wrote:

> I'm trying to make a rule that checks incoming mail headers by using the
> following rule:
>
> if $h_from: contains "email1@???" or
>    $h_from: contains "email2.com" or
>       ...
> then
>    deliver emailaddress1@domain
>    deliver emailaddress2@domain
> endif

>
> The structure works, but is there a more effective method of creating the
> header checking part?


1. Regular expressions are your friend. If you can write a pattern that
matches the set of things you are looking for, you can do it in a single
"matches" test.

2. If you have a huge number of these things, you can stick them in a
file, and do

if ${lookup{$h_from:}lsearch{/the/file}{yes}{no}} is yes then ...

That's a slow linear search, but you could use a fast DBM or cdb lookup
for better performance.

A linear in-memory search will probably be faster than a linear file
search, but when the numbers get big, an indexed lookup may well be
better.


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