Exim use Smart Host on cPanel

To configure a smart host, create /etc/exim.conf.local on the source server (server1 in this example) and add the following lines. Be sure to change to the hostname or IP of the smart host server.

1
2
3
4
5
6
@ROUTERSTART@
    smart_route:
    driver = manualroute
    domains = !+local_domains
    transport = remote_smtp
    route_list = * host.name.of.smart.host.server

Assuming this server (server1) is a cPanel server, next run /scripts/buildeximconf and then /scripts/restartsrv_exim. If not, simply restart your Exim server using normal init scripts.

 

Smarthost Server Config

Assuming you’re installing the yum version of Exim on a CentOS/RHEL server, you’ll need to make two configuration changes. The first is to allow the IP of the mailserver to relay through the smarthost. Open the configuration at /etc/exim/exim.conf, find the line referenced below and edit it replacing x.x.x.x with your mailserver IP.

 

1
hostlist   relay_from_hosts = 127.0.0.1 : x.x.x.x

 

Second, you’ll need to tell Exim not to listen only on the localhost address for incoming mail, which is the default. Again find the configuration line below and add a hash (#) in front of it to comment it out.

 

1
local_interfaces = <; 127.0.0.1 ; ::1

 

Save the modified config file and restart Exim on this server.

That’s it; watch the logs for a bit to make sure it’s working! The easiest way is to just tail -f /var/log/exim_mainlog on both servers and then send a message from server1 to a remote host, and watch for the mail to travel out server2!

 

Leave a Reply

Your email address will not be published. Required fields are marked *