Re: [exim] Exim: smart_route / routing based on From:

Etusivu
Poista viesti
Vastaa
Lähettäjä: Phil Pennock
Päiväys:  
Vastaanottaja: ml
Kopio: exim-users
Aihe: Re: [exim] Exim: smart_route / routing based on From:
On 2006-02-23 at 13:42 +0100, ml@??? wrote:
> smart_route:
> driver = manualroute
> domains = ! +local_domains
> transport = remote_smtp
> route_list = "* serverabc"
>
> which works pretty good, but now i want one exception from this rule:
> If "From:" of the Mail (not neccessarily the Sender:) is foo@baa mails should be send
> through serverxyz.
>
> is this possibile ?


Yes, use a different Router which uses a condition rule to match on
$h_from; put this first. You can then simplify the smarthost router.

If you want to keep it all in one Router, then you can use route_data
instead of route_list and then embed the condition inside the string.
Whilst more concise, that's more confusing for a simple "if this one
address"; it does start to make sense if you want to use many different
servers for different users, or at least write it that way. For that
last case, you can then put the "user: server" stuff in a lookup file
and use:

route_data = "* ${lookup {${address:$h_from}} lsearch{/file/name} {$value}{serverabc}}"

For the simple case of one user to one server, put a copy of the
smart_route Router above that one, with a different name and smarthost,
and insert:

condition = ${if match_address{${address:$h_from}}{+senders_to_serverxyz} {yes}{no}}

This requires the addresslist +senders_to_serverxyz simply because I
think it's more maintainable to move that logic out to the start of the
file in the main config section with:

addresslist senders_to_serverxyz = foo@bar : baz@bat

Regards,
--
I am keeping international relations on a peaceable footing.
You are biding your time before acting.
He is coddling tyrants.
-- Roger BW on topic of verb conjugation