Re: [Exim] Creating domainlist with SQL select

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Kirill Miazine
Datum:  
To: Eli
CC: exim-users
Betreff: Re: [Exim] Creating domainlist with SQL select
EHLO

Read section 10.7 in the Exim spec. You have obviously not done so.

(You should be reading section 10.7 now...)

Now that you have read section 10.7, here is what you could use:

domainlist virtual_domains = \
    mysql;select host from users where host='$domain' limit 1


QUIT

Eli wrote:
> I recently found out that:
>
> domainlist virtual_domains = ${lookup mysql{SELECT DISTINCT host FROM users}}
>
> wasn't working properly. I turned debugging on to find out that the SQL
> select was just fine - Exim got the proper list of domains. However, when
> Exim later went to check for a domain in this domainlist, the search failed.
> The domain it was searching for was indeed in the list of returned values,
> but I think what happened is that Exim treated the SQL results as one single
> string (with \n characters after each domain).
>
> So, to fix it I changed that to:
>
> domainlist virtual_domains = ${lookup mysql{SELECT DISTINCT host FROM users \
>     WHERE host = '${domain}'}}

>
> and that fixed it right up since it only ever contained the one domain in
> question in the list, thus the search passed and everything was fine.
>
> My concern is that there might be some time when ${domain} isn't defined to
> the correct value or something, and when I use the virtual_domains
> domainlist, the value returned could be incorrect for the circumstances.
> So, I am wondering how I can get my original line working, but so that each
> item returned from the SQL query is added as a separate actual domain into
> the domainlist.
>
> Should I be using the syntax:
>
> Domainlist virtual_domains      = mysql;SELECT DISTINCT host FROM users

>
> instead? I remember trying that originally and it didn't work.
>
> Any help would be appreciated!


--
Kirill Miazine
mailto:km@krot.org
http://km.krot.org/