How to configure domain specific relay hosts in exim using remote_smtp with CPanel

So you have, for whatever reason, a requirement to send all mail from CPanel server x addressed to * via a specific smtp server. I recently ran into this issue and found a relatively simple fix. Unlike Microsoft Exchange and its easy UI where you can create a send connector with a bunch of prerequisites, with exim you need to work on the exim.conf file. Luckily its actually not that hard, once you know how!

  1. Open Exim configuration from within WHM
    Open up a WHM connection to your CPanel server and head to Service Configuration >> Exim Configuration Editor then click on Advanced Editor.
  2. I will take this moment to make a note:- if you are running a CPanel server you MUST use the WHM editor Exim Configuration Editor, I learnt the hard way before I even knew you could edit this option in WHM by editing exim.conf on a CPanel server that it will definitely be overwritten at some stage by an update! However these changes also apply to a non CPanel server that uses Exim by applying the same changes to /etc/exim.conf. See image below.

  3. Find and edit the Routers Configuration
    Find the editable section below ROUTERS CONFIGURATION it looks something like this.
    Just below the section that says demo accounts are not permitted to relay email is where we are going to add our relay hosts. And below is a demo of a very basic send connector.

    driver = manualroute
    transport = remote_smtp
    route_list =

    This one here basically would take anything sent to a address and send it out via

  4. Save your changes and restart Exim
    Save the changes you have made by clicking save at the bottom of the page, then go to Restart Services >> Mail Server (Exim) then click yes. And test away.

This is a fairly basic setup and is intended to be used in a server that “sends to the world” directly already. IE this is for those domains that become a problem or in your environment may need to be routed differently than what the DNS resolve for that address might come up with.

Any questions, leave them in the comments! :)


Tags: , , , , , , , , , ,

2 Responses to “How to configure domain specific relay hosts in exim using remote_smtp with CPanel”