edouard.boucher@??? wrote:
> hi,
>
> to check if the prb came from the fact that redirect_router has no effect if the
> new generated address is the same as the old one,
> i have tryed all the possible setting in the loop_mx router for
>
> check_ancestor
> repeat_use
>
> (false, false) (false, true) (true, true) (true, false)
>
> and in each case i get (when using exim -bt)
>
> unroutable address,
> and the loop_mx is used only once whereas i tryed with a domain containing a lot
> of MX reconds
Don't tell ANYONE that I did THIS! It's sick, it's maybe slow, and it
exploits exims features to the edge.
# First lookup the MX records and save it in address_data
# We rewrite \n to a space to make it easier to filter
lookup_mx:
driver = redirect
domains = +backup_domains
address_data = ${sg { ${lookup dnsdb {MX=$domain}}} {\n}{ }}
data = $local_part@$domain
redirect_router = loop_mx
# This loops until we have only one MX left
# we enforce the looping by rewriting the address
# on every pass with an hash of the current address_data
# +rerouteme + $local_part@domain
# SICK!
loop_mx:
driver = redirect
domains = +backup_domains
local_part_prefix = *rerouteme-
local_part_prefix_optional
debug_print = "Address_data: $address_data"
condition = ${if match \
{$address_data}{\N(\d+)\s+([^\s]+)\s(\d+)\s+([^\s]+)(.*)\N}{1}}\
address_data = ${if match {$address_data} \
{\N(\d+)\s+([^\s]+)\s(\d+)\s+([^\s]+)(.*)\N} \
{${if < {$1}{$3} {$1 $2$5}\
{$3 $4$5}}}\
}
data = "${md5:$address_data}rerouteme-$local_part@$domain"
redirect_router = loop_mx
# This strips our reroute information after we are done
strip_reroute:
driver = redirect
domains = +backup_domains
local_part_prefix = *rerouteme-
data = $local_part@$domain
redirect_router = route_domain
# this finaly routes the domain, with the host in $address_data
route_domain:
driver = manualroute
domains = +backup_domains
route_data = ${extract {2}{ }{$address_data}}
no_more