Re: [exim] MySQL question

Pàgina inicial
Delete this message
Reply to this message
Autor: Jeff Cronstrom
Data:  
A: Alexander Nance
CC: exim-users
Assumpte: Re: [exim] MySQL question
On Mon, 2008-03-03 at 11:48 -0500, Alexander Nance wrote:

> I am sure that this has been asked and answered before, but I could not
> find anything in the search. Is there a way to populate a manual route
> from a MySql database? Basically all that is needed is a simple two or
> three field Mysql table where the recipient domain and route_list server
> are populated.
>
>
>
> Thanks for your help.
>



## Router

static_route_out:
  driver = manualroute
  transport = remote_smtp_out 
# Setup Routing for domains that are locally specified that really get
relayed  
# to and internal server or an external server after getting spam and
virus
# scanned.
  route_data = ${lookup mysql{SELECT server_id FROM domains WHERE \
                type='out' AND enabled='1' AND domain='${quote_mysql:
$domain}'}}


## Transport


remote_smtp_out:
  driver = smtp
  delay_after_cutoff = false
  no_retry_include_ip_address
  headers_add = ${if >{$spam_score_int}{${lookup mysql{select sa_tag *
10 from domains \
                where domain = '${quote_mysql:$domain}' \
                and spamassassin = '1' \
                and type = 'out' }{$value}fail}} {X-Spam-Status: YES
\nX-Required_score: REQUIRED\nSubject: **** SPAM **** $h_subject:\n}{} }
  headers_remove = ${if or { { <{$spam_score_int}{1} } \
                             { <{$spam_score_int}{${lookup mysql{select
sa_tag * 10 from domains \
                               where domain = '${quote_mysql:$domain}' \
                               and spamassassin = 1 \
                               and type = 'out'}{$value}fail}} } \
                             { eq {0}{${lookup mysql{select sa_tag * 10
from domains \
                               where domain = '${quote_mysql:$domain}' \
                               and spamassassin = 0 \
                               and type = 'out'}{$value}fail}}} \
                          } {X-Spam-Score:X-Spam-Report} }


interface = 10.10.10.220

## route to alternate port if configured so.
 port = ${lookup mysql{SELECT port FROM domains WHERE \
                type='out' AND enabled='1' AND domain='${quote_mysql:
$domain}'}}


fallback_hosts = int.fallback.example.com


--jeff