Re: [Exim] SQL and aliases.

Góra strony
Delete this message
Reply to this message
Autor: Eric Renfro
Data:  
Dla: exim-users
Temat: Re: [Exim] SQL and aliases.
On Monday 21 October 2002 11:04 am, Steve Haslam wrote:
> On Mon, Oct 21, 2002 at 10:59:22AM -0500, Eric Renfro wrote:
> > 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
>
> You need to write
>
> WHERE domain = '${quote_pgsql:$domain}'
>
> ${quote_pgsql:...} doesn't add the single-quotes.


Yeah, Nico corrected me on that when I replied privately to his email, instead
of to the list. I'm not used to mailing-lists that don't use the From address
of the list itself. (I like that way!)

Anyway.

> > 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?
>
> sth like:
>
> domains = pgsql;SELECT DISTINCT domain FROM staticlists


How about something like this, would come to play:

domainlist staticlists_domains = \
        ${lookup pgsql {SELECT DISTINCT domain FROM staticlists WHERE domain =
${quote_pgsq:$domain}}


How would I use that in the sql_aliases router that's like:

sql_aliases:
  driver = redirect
#  domains = staticlists_domains
  allow_fail
  allow_defer
  data = ${lookup pgsql { \
    SELECT email \
      FROM staticlists \
      WHERE domain = '${quote_pgsql:$domain}' \
      AND list = '${quote_pgsql:$local_part}' \
    } \
  }
  file_transport = address_file
  pipe_transport = address_pipe




--
Eric Renfro
Myrddin Computers & Designs - CEO/President