Re: [exim] route_list

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Peter Bowyer
Datum:  
To: exim-users
Betreff: Re: [exim] route_list
Chris Knipe <savage@???> wrote:
> Hi all,
>
> Can someone help me out with this router?? I'm having a bit of
> trouble...
>
> virtual_gateway:
> driver = manualroute
> domains = ${lookup mysql{SELECT Zonename FROM SMTPZones WHERE
> ZoneState='Local' AND ForwardTo IS NOT NULL;}}
> transport = remote_smtp
> ignore_target_hosts =
> 0.0.0.0/8:10.0.0.0/8:172.16.0.0/12:192.168.0.0/16:127.0.0.0/8: \
>
> 169.254.0.0/16:192.0.2.0/24:192.88.99.0/24:224.0.0.0/4:240.0.0.0/4
> route_data = ${lookup mysql{SELECT ForwardTo FROM SMTPZones WHERE
> ZoneState='Local' AND ZoneName='${quote:$domain}';}}


You can simplify this a fair bit using some built-in $magic in Exim...

virtual_gateway:
driver = manualroute
domains = mysql; select ForwardTo FROM SMTPZones WHERE ZoneState='Local'
AND ZoneName='${quote_mysql:$domain}'
transport = remote_smtp
ignore_target_hosts =
0.0.0.0/8:10.0.0.0/8:172.16.0.0/12:192.168.0.0/16:127.0.0.0/8
route_data = $domain_data

Note the use of the magic mysql lookup to run a qery which returns the
'ForwardTo' value. If the query fails (ie returns no results) , the router
passes; if it returns a value, then that value is saved in $domain_data and
picked up again in the route_data option. Also I use ${quote_mysql instead
of ${quote which does some slightly differrent things in some unlikely
circumstatnces and is more correct here.

NB Untested, probably has typos, may not work in your circumstances, lines
will have wrapped, etc etc. Test on a hidden area before appying to large
surfaces. Close cover before striking.

Peter