Using exim4 I have set up a route to use an external SMTP server. I am using cPanel which keeps a list of domains set up locally on the server in the file: /etc/localdomains . As a result I have set up a condition to only send through this relay if the sender address domain is in this file. This works just fine.
However now I want to add another condition that ensures that if a domain is listed in a file say /etc/norelaydomains it should NOT be sent using the relay. I thought it would be an easy matter to get this to work by adding a similar condition to the one ensuring the domain is in /etc/localdomains, however this does not seem to work correctly (no mail sent using the relay).
To recap what I want is: if sender_domain is IN /etc/localdomains and sender_domain is NOT IN /etc/norelaydomains then send using relay, otherwise send using local mail server.
My normal setup that works fine is:
my_route:
condition = ${lookup {$sender_address_domain} \
lsearch {/etc/localdomains} {yes}}
driver = manualroute
domains = !+local_domains
transport = my_relay
route_list = * mysmtp.com
The setup I have attempted (using this no mails go through the relay)
my_route:
condition = ${lookup {$sender_address_domain} \
lsearch {/etc/localdomains} {yes}}
condition = ${lookup{$sender_address_domain} \
lsearch{/etc/norelaydomains} {no}}
driver = manualroute
domains = !+local_domains
transport = my_relay
route_list = * mysmtp.com
Any help on getting this to work would be much appreciated.