[Exim] Creating domainlist with SQL select

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Eli
Dátum:  
Címzett: exim-users
Tárgy: [Exim] Creating domainlist with SQL select
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!

Thanks,

Eli.

---
[This E-mail scanned for viruses]