[Exim] Routing based on sender domain

Pàgina inicial
Delete this message
Reply to this message
Autor: Rennie deGraaf
Data:  
A: exim-users
Assumpte: [Exim] Routing based on sender domain
Is there a way to route mail based on the domain of the sender? I want
all mail sent to my domain from domains that I am relaying to be routed
to one host, and all other mail routed to another.

What I currently have is this:

domainlist local_domains = /etc/mail/local_domains
domainlist relay_to_domains = /etc/mail/relay_domains
...

# Route incoming mail from trusted domains to host1
# We already checked for envelope sender domain spoofing in the ACLs
trusted_incoming_mail:
  driver        = manualroute
  domains       = +local_domains : +relay_to_domains
  condition     = ${if match {mydomain.zz}{$sender_address_domain}
{yes}{no}}
  transport     = remote_smtp
  route_list    = * host1



# Route all other incoming mail to host2; it knows what to do with it.
incoming_mail:
driver = manualroute
domains = +local_domains : +relay_to_domains
transport = remote_smtp
route_list = * host2

This works. However, I want the condition in my "trusted_incoming_mail"
router to be more general. Is there a way to match
$sender_address_domain to a domainlist? I tried the following, but it
didn't work:

  condition     = ${if match {+relay_to_domains :
+local_domains}{$sender_address_domain} {yes}{no}}


Is there a way to craft a condition to do something like this?
Unfortunately, I couldn't get exim's debug mode to show me any details
of why it failed.

Thanks for the help.

Rennie deGraaf
System Administrator
Verano <www.verano.com>