Re: [Exim] Hmm

Pàgina inicial
Delete this message
Reply to this message
Autor: Nico Erfurth
Data:  
A: Adam H. Pendleton
CC: exim-users
Assumpte: 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