Re: [exim] Smarthost both complete domain or per specific em…

Top Page

Reply to this message
Author: Dominic Benson
Date:  
To: exim-users
Subject: Re: [exim] Smarthost both complete domain or per specific email address
On 01/09/11 17:20, Hermes Mauricio López wrote:
>
> On Thu, Sep 1, 2011 at 4:09 AM, Dominic Benson<dominic@???> wrote:
>> On 31/08/11 11:48, Hermes Mauricio López wrote:
>>> Hello there, I have been digging around how to forward email to second
>>> email server, I have had success on either relaying for a complete
>>> domain with this instruction:
>>>
>>>    route_data = ${lookup{$domain}lsearch{/etc/staticroutes}}

>>>
>>> or per specific email with this one:
>>>
>>> route_data = ${lookup{$local_part@$domain}lsearch{/etc/staticroutes}}
>>>
>>> However what I need is to be able to use both at same time, so that my
>>> staticroutes file could be like this:
>>>
>>> user@??? 1.2.3.4
>>> domain2.com            2.3.4.5

>>>
>>> I have tried with: "partial-lsearch", ";" and "+" combinations of both
>>> instructions, but so far nothing has worked for me.
>>>
>>> Would you mind giving me a hint of what am I missing?
>>>
>>> Thank you in advance.
>>>
>>> Hermes.
>>>
>> Why not use two routers? One for the domain lookup, another for the per-user
>> overrides.
> Hello Dominic, what is the sintax to define 2 routers?
>
> Thank you.


Just copy the router definition you have, but give the copy a different
name

e.g.

router_1:
driver manualroute
route_data = ${lookup{$local_part@$domain}lsearch{/etc/staticroutes}}
transport = remote_smtp
host_find_failed = pass

router_2:
driver manualroute
route_data = ${lookup{$domain}lsearch{/etc/staticroutes}}
transport = remote_smtp
host_find_failed = pass


although it would seem cleaner to use different lookup files for the two
searches.

However, that said, I have to say that Bill's suggestion to use
wildlsearch is neater again