Exim Ignore MX Record

There are some cases where you want to ignore the configured MX record in order to deliver e-mails for a domain and instead deliver them to a preconfigured server. A very common situation where you want to do this is when you provide advanced anti virus and anti spam solutions to your clients. In those cases you want any mail delivered for a domain to be forwarded to you advanced anti virus/anti spam server. Below we will show you how to do this and forward any mail for cphelp.gr and all it’s sub domains to the server superantispam.cphelp.gr instead of the MX record that shows mail.cphelp.gr.

Login to your server through ssh and create the file /etc/hubbed_hosts. In this file insert the following lineĀ  (the first column is the domain to forward and the second column the MTA to forward the domain):

# Domain      MTA
*.cphelp.gr     superantispam.cphelp.gr

Save the file and exit SSH. Then login to WHM and under “Service Configuration” click on “Exim Configuration Editor”. Then click on “Advance Editor” and find the config section “ROUTERS CONFIGURATION”. Enter the following lines in the first text box:

  driver = manualroute
  domains = "${if exists \

route_data = ${lookup{$domain}partial-lsearch{/etc/hubbed_hosts}}
transport = remote_smtp

Save the configuration, wait for exim to restart and test you new Exim configuration.

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.