Introduction
In some cases, you may want to have some domains use one smarthost while other domains use a different smarthost. This article provides the steps needed to configure your server to use multiple smarthosts.
Procedure
Please note that the following procedure is a task intended for system administrators. cPanel's Technical Analysts cannot provide assistance in configuring a server's smarthost setup.
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Create a smarthost parameter file in the
/etc
folder.
Please note that for this procedure, we assume that the smarthost parameter file is/etc/exim_smarthosts
. - Open the smarthost parameter file in your preferred text editor.
- Add a line similar to the following for each domain that will use a smarthost.
$domain.tld: domain=$domain.tld user=$smarthostuser pass=$smarthostpwapi smtp=$smarthostaddress port=$port
Please note that "$domain.tld," "$smarthostuser," "$smarthostpwapi," "$smarthostaddress," and "$port" must be replaced with the domain to use the smarthost, the username for the smarthost, the password or API key used with the smarthost, the smarthost's SMTP hostname, and the smarthost's SMTP port, respectively. - Save the changes and exit the text editor.
- Log into WHM as the ‘root’ user.
- Navigate to "Home / Service Configuration / Exim Configuration Manager."
- Click the "Advanced Editor" tab.
- Scroll down to the "Section: AUTH" textbox.
- Replace the
client_send
line with the following.hide client_send = : ${extract{user}{${lookup{$sender_address_domain}lsearch{/etc/exim_smarthosts}}}}: ${extract{pass}{${lookup{$sender_address_domain}lsearch{/etc/exim_smarthosts}}}}
- Scroll down to the "Section: PREROUTERS," "Section: ROUTSTART," or "Section: POSTMAILCOUNT" textbox, depending on which is used by your smarthost configuration.
- Add the following lines below the
domains
lines.condition = "${if eq{${lookup{$sender_address_domain}partial-lsearch{/etc/exim_smarthosts}{$value}}}{}{false}{true}}"
headers_add = "${perl{mailtrapheaders}}"
- Replace the
route_list
line with the following.route_list = * ${extract{smtp}{${lookup{$sender_address_domain}lsearch{/etc/exim_smarthosts}}}}
- Scroll down to the "Section: TRANSPORTSTART" textbox.
- Add the following line below the
driver
line or replace the existingport
line.port = ${extract{port}{${lookup{$sender_address_domain}lsearch{/etc/exim_smarthosts}}}}
- Scroll to the bottom of the page.
- Click the "Save" button.
Please note that Exim be restarted each time additional entries are added to the smarthost parameter file.