I want to route emails with the From: .*@host1.com
through smtp.server1.com
and emails with the From: .*@host2.com
through smtp.server2.com
.
For the moment, I have smarthost configured with dpkg-reconfigure exim4-config
so that update-exim4.conf.conf
contains the line dc_smarthost='smtp.server1.com::587'
. That is, everything routes through smtp.server1.com
.
I tried adding another router just before the definition of smarthost:
in the config file, setting senders = .*@host2.com
smarthost_server2:
debug_print = "R: smarthost_server2 for $local_part@$domain"
driver = manualroute
domains = ! +local_domains
transport = remote_smtp_smarthost
senders = .*@host2.com
route_list = * smtp.server2.com byname
host_find_failed = ignore
same_domain_copy_routing = yes
no_more
but exim still routes everyting via smtp.server1.com
. Do I use the senders
condition correctly?
AFAIU, this should be a rather common setup for cases when people with emails .@google.com and .@gmail.com do not want to reveal in their @gmail.com email headers the fact that they are also google employees, so the routhing should be different.