Phill Harvey-Smith wrote:
> Hi,
>
> I'm having problems with a couple of routers in my exim.conf, routers in
> question are as follows :-
>
> hostlist warwick_hosts = 127.0.0.1 : 137.205.0.0/16
>
> # Alias database lookup, the first one accepts email to aliases that are
> # flagged for accepting mail for any address either external or
> # internal.
>
> mysql_alias_nonlocal:
> driver = redirect
> data = ${lookup mysql{select alias from alias where
> address='$local_part@$domain' and local_only='N'}}
> allow_fail
> allow_defer
> file_transport = address_file
> pipe_transport = address_pipe
>
> # Alias database lookup, this second lookup processes aliases that are
> # only valid for local (warwick) addresses, any address that has
> # local_only set to 'Y' can only receive mail from within warwick.
>
> mysql_alias_local:
> driver = redirect
> data = ${lookup mysql{select alias from alias where
> address='$local_part@$domain' and local_only='Y'}}
> allow_fail
> allow_defer
> condition = ${if {match_ip{$sender_host_address}{+warwick_hosts}}}
> file_transport = address_file
> pipe_transport = address_pipe
>
>
> Both of these work as intended for aliases that expand to a single email
> address, however if I have an alias that is flagged for non-local, which
> expands to one or more addresses that are flagged for local only those
> addresses will fail as the $sender_host_address is not a local one.
>
> Is there any way that I can detect this and enable the non-local
> delivery for addresses that are expanded from other aliases.
>
> Cheers,
>
> Phill.
>
Observation:
- both routers use the redirect driver type
- both routers use the same transport(s)
- a transport may utilize an SQL call as easily as a router.
On which score, it might make the issue easier to address if the SQL were a bit
more clever AND the router either called different transports (based on the SQL
returned), AND/OR the transport(s) were themselves SQL 'steered'.
It also appears that you need logic to specifically handle that 'third
condition', as in:
- determine whether there ARE expansions.
- split them for separate handling IF required ELSE NOT
THEN do the actual handling.
... which should be more straightforward than detecting them mid-stream and
adapting behaviour on-the-fly.
HTH,
Bill