Re: [Exim] Hmm

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Nico Erfurth
Data:  
Para: Adam H. Pendleton
CC: exim-users
Asunto: Re: [Exim] Hmm
Adam H. Pendleton wrote:
> Out of curiosity...
>
> I am using mysql for my lookups, and I have the following code for
> local_domains:
>
> domainlist local_domains = \
> ~  ${lookup mysql {SELECT domain FROM domains \
> ~    WHERE type="local" and domain="${domain}" }}

>
> My question is this:
>
> What effect does "and domain="${domain}" have on the results of that
> query. What value does ${domain} expand to?


$domain expands to the domainpart of the CURRENT handled address,
without this condition, the lookup would return:

domain1.tld
domain2.tld
domain3.tld

as a SINGLE string, and no would match this string (unless you have just
a single domain in your database).

Mostly it's better to use the command-style lookup in lists, like

domainlist local_domains = mysql;select 1 from domains where \
                     type='local' and domain='$domain'


this means "If the lookup returns something, it's ok", with your list,
it would first expand everything, replace the expansion-string with the
selected domain, and do a string-comparsion against it.

Nico