Forwarders not being excluded from MailChannels

Jul 25, 2003
24
2
228
cPanel Access Level
DataCenter Provider
We utilize MailChannels for outbound scanning. I have a few domains that are excluded from being relayed through MailChannels. Mail sent from the server itself (PHP scripts, local mail users) ends up being routed correctly (it avoids MailChannels and is sent directly to the destination).

However, these domains have forwarders setup (for example, [email protected] forwards to [email protected]). The forwarders are still being routed through MailChannels.

The forwarders seem to be using the 'virtual_aliases_nostar' router in exim, but I am not sure how exactly to force the mailchannels router to check the forwarding address/domain and exclude messages based on that.

Code:
#MAILCHANNELS_ROUTESTART
send_via_mailchannels:
driver = manualroute
domains = ! +local_domains
senders = !*@excluded-domain1.com :  !*@server.hostname.com : !*@excluded-domain2.com
transport = mailchannels_smtp
hosts_randomize = true
route_list = * smtp.mailchannels.net::587:smtp1.mailchannels.net::587 randomize byname
host_find_failed = defer
no_more
#MAILCHANNELS_ROUTESTOP
Thanks for the help.
 
Jul 25, 2003
24
2
228
cPanel Access Level
DataCenter Provider
Heard back from MailChannels, apparently you have to go the smart hosts route and include ALL domains on the server in a static_route file that you want relayed. There isn't a way to just exclude domains.

Hi,

Thank you for contacting MailChannels Support.

If you want to exclude forwarding emails from being routed through MailChannels. Kindly modify the "send_via_mailchannels:" configuration under ROUTERSTART/POSTMAILCOUNT section.

send_via_mailchannels:
driver = manualroute
domains = !+local_domains
condition = "${if eq{${lookup{$sender_address_domain}partial-lsearch{/etc/static_route}{$value}}}{}{false}{true}}"
headers_add = "${perl{mailtrapheaders}}"
transport = mailchannels_smtp
route_list = !+local_domains "${lookup{$sender_address_domain}partial-lsearch{/etc/static_route}}"

Create the file "/etc/static_route" and set the ownership and permission as follows

touch /etc/static_route
chown root:mail /etc/static_route
chmod 660 /etc/static_route

Then add the list of domains for which mails should be relayed through MailChannels in the file "/etc/static_route" in the following format

yourdomain.com: smtp.mailchannels.net
yourdomain2.com: smtp.mailchannels.net

Finally restart the exim service and verify the new settings by sending test mails from your end.

Note : Please note that this is a workaround to exclude the forwarded mails. In this case you should add all the domains that needs to be relayed through MailChannels in the "/etc/static_route" file.
Regards,
Maria jose
MailChannels Support