Re: [Exim] improvments to exim

Top Page
Delete this message
Reply to this message
Author: Kjetil Torgrim Homme
Date:  
To: Avleen Vig
CC: exim-users
Subject: Re: [Exim] improvments to exim
On Thu, 2003-12-18 at 23:01, Avleen Vig wrote:
> Actually my example was bad. Here's a better one:
>
> for i in (h_x-mailer h_from h_to h_subject) match any {
> {$i:}{${lookup mysql{select $i from table...}}} {yes}{no}
> }
> data = :blackhole:
>
> Would provide nice header-based filtering in the router.
> Currently I have to have multiple routers to achieve the same thing.
> in this example, the condition would be true if any of the loops
> returned 'yes' (note the 'match any' i added in).


better example, but still not very painful today:

condition = ${lookup mysql{select distinct 'true' from table \
                           where (field = 'from' and value = $h_from) \
                              or (field = 'x-mailer' and value = $h_x-mailer) \
                              or (field = 'subject' and value = $h_subject) \
                              or (field = 'to' and value = $h_to)}}


this is a little more verbose, but more efficient since there's only one
SQL query. to reduce verbosity, it would be useful to have macros
taking arguments, something like

MATCH(x) = (field = 'x' and value = $h\_x)
condition = ${lookup mysql{select distinct 'true' from table \
                           where MATCH(from) \
                              or MATCH(x-mailer) \
                              or MATCH(subject) \
                              or MATCH(to)}}


perhaps just hack in M4-support? then you get looping constructs during
preprocessing, but not during execution.

--
Kjetil T.