Re: [Exim] local domains from mysql db

Top Page
Delete this message
Reply to this message
Author: exim
Date:  
To: exim-users
Subject: Re: [Exim] local domains from mysql db
> On 2002-03-23 at 17:18 -0000, Gareth Down wrote:
> > .. that works fine, but the local domains setting:
> > local_domains = "mysql; select domain_name from domains;"
> > causes exim to think that *every* domain name is a local domain,

obviously
> > causing major problems.


<phil>
>  +-----+-------------------+
>  | foo | domain_name       |
>  +-----+-------------------+
>  |   1 | example.org       |
>  |   2 | fred.invalid      |
>  |   3 | foo.bar.example   |
>  +-----+-------------------+

>
> "select domain_name from domains;" will return how many rows from this
> little database?
>
> Hint: answer != 1

</phill>

True, but when you do "lsearch;/usr/exim/aliases/domains" the answer is also
!= 1 isn't it?

<phill>
> Try an SQL example to restrict the number of rows, using some data from
> the mail, which you're trying to look up.
> Eg: select domain_name from domains where domain_name = $domain;
> (or somesuch; I don't actually use SQL and Exim together).

</phill>

I tried that ("mysql;select domain_name where domain_name = '$domain';") but
that didn't work...

does anyone know if this would work:

assign the result of a query to a variable replacing end of rows with line
breaks (I seem to remember reading that this is possible with exim?)
then do an lsearch on the result variable to get the local domains,
in pseudo code:

$result = sql query......
convert_to_linebreaks($result)
local_domains = lsearch;$result

however this seems like a convoluted method of solving what seems like such
a simple problem!

Surely there is an easier way!

Anyone?....

Gareth Down
iHostWeb Services
gjd@???