So you have, for whatever reason, a requirement to send all mail from CPanel server x addressed to *@domain.com 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!
- 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. - 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.
domain1send:
driver = manualroute
transport = remote_smtp
route_list = domain1.com smtp2.anotherserver.comThis one here basically would take anything sent to a @domain1.com address and send it out via smtp2.anotherserver.com.
- 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!
