Re: [exim] query lookups with multiple rows as result

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Peter Bowyer
Dátum:  
Címzett: marco
CC: exim-users
Tárgy: Re: [exim] query lookups with multiple rows as result
On Sun, 5 Dec 2004 23:25:17 +0100, Marco Herrn <marco@???> wrote:
> Hi,
>
> I have a problem in understanding the query style lookups in Exim 4.
> I need a lookup to get a list of local parts. A I understand the FAQ
> in question Q0080, this should be no problem. I have the following
> router:
>
> hosteduser:
>  driver= accept
>  domains= +hosted_domains
> #  local_parts= ${lookup pgsql{\
> #                     SELECT localpart FROM mailbox WHERE domainname='$domain'}\
> #                     {$value}\
> #                fail}
>  local_parts= pgsql;SELECT localpart FROM mailbox WHERE domainname='$domain'
>  transport= hosted_delivery
>  cannot_route_message= Unknown mailbox


try this:

hostedused:
driver=accept
domains = +hosted_domains
condition = $lookup pgsql {\
                SELECT localpart from mailbox \
                WHERE domainname='${quote_pgsql:$domain}' AND \
                localpart = '${quote_pgqsl:$localpart}'\
                }
transport=hosted_delivery
cannot_route_message = Unknown mailbox


Or you could use a construct with $sg to make a colon-separated list from
the simpler query you had, as Stephen suggested already.

NB I didn't test this... please check my syntax and logic before implementing...

Peter