Re: [exim] Populate a local recipient array from MySQL

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Phil Pennock
Date:  
À: Rick Duval
CC: exim-users
Sujet: Re: [exim] Populate a local recipient array from MySQL
On 2008-11-18 at 21:46 -0500, Rick Duval wrote:
> The thing is that this is a pass thru spam filter so no users actually
> exist. I just want to check incoming mail against the MySql Database.
>
> Currently acceptance of emails is accomplished through populating the
> "local_domains" list from the MySQL db with the statement
>
> "domainlist local_domains = ${lookup mysql {SELECT DISTINCT domain
> FROM domains WHERE Enabled = 1 and domain='${quote_mysql:$domain}'}} "
>
> But I'm not aware of a way to do the same thing with an entire email address.


Where you currently have "domains = +local_domains" on some number of
Routers, you should be able to instead have:

  condition = ${lookup mysql {SELECT DISTINCT user,domain FROM whatever \
                WHERE Enabled = 1 and domain='...' and user='...'}\
        {true}{false}}


Note that ${lookup...} takes optional extra parameters so that instead
of the $value from the actual lookup, you can use different results for
the match-found and no-match-found cases.

Alternatively, you can use a localpartlist with a name of your choice
and add a local_parts restriction to the Router(s).

-Phil