Re: [Exim] SQL and aliases. (fwd)

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Nico Erfurth
Datum:  
To: exim-users@exim.org
Betreff: Re: [Exim] SQL and aliases. (fwd)
On Mon, 21 Oct 2002, Eric Renfro wrote:

> On Monday 21 October 2002 10:33 am, Nico Erfurth wrote:
> > On Mon, 21 Oct 2002, Eric Renfro wrote:
> > > sql_aliases:
> > > driver = redirect
> > > allow_fail
> > > allow_defer
> > > data = ${lookup pgsql {SELECT list,email FROM staticlists WHERE domain
> > > = '$domain'}}
> >
> > This selects 2 fields, they will be both returned with ther name and an =
> > prepended, that's what you see in the logfile, use this instead
> > data = ${lookup pgsql {SELECT email FROM staticlists WHERE domain =
> > ${quote_mysql:$domain}'}}
> >
> > but i think you really want this
> > data = ${lookup pgsql {SELECT email FROM staticlists WHERE domain =
> > ${quote_mysql:$domain} and list = {$quote_mysql:$local_part}'}}
> >
> >
> > ciao
>
> Oct 21 10:44:02 ginseng.myrddincd.com oidentd[11161]: Connection from
> ginseng.myrddincd.com (192.168.1.10):0
> Oct 21 10:44:02 ginseng.myrddincd.com oidentd[11161]: [ginseng.myrddincd.com]
> Successful lookup: 43698 , 25 : psi-jack (psi-jack)
> Oct 21 10:44:02 ginseng.myrddincd.com exim[11160]: [1\3] 2002-10-21 10:44:02
> H=ginseng.myrddincd.com [192.168.1.10] (psi-jack) sender verify defer for
> <psi-jack@???>: failed to expand "${lookup pgsql {SELECT email FROM
> staticlists WHERE domain = ${quote_pgsql:$domain} AND list =
> ${quote_pgsql:$local_part} } }": lookup of "SELECT email FROM staticlists
> WHERE domain = myrddincd.com AND list = psi-jack " gave DEFER: PGSQL: query
> failed: ERROR: Relation "myrddincd" does not exist


mhhh, strange, you need to single-quote your strings, even if you use the
quote_* operator
data = ${lookup pgsql {SELECT email FROM staticlists WHERE domain =
'${quote_pgsql:$domain}' and list = '{$quote_pgsql:$local_part}'}}

> Okay.. This is getting confusing. ;) It's looking up the alias, twice, now,it
> looks.
>
> Now, I guess, How could I get it to only check domains listed by a staticlists
> quqery, and only lookup queries for the desintation being $local_part, so it
> doesn't try to double-send emails, and failing the second time around?


Try this lookup first

ciao