Set up SMTP relay with cPanel

Estimated reading time: 1 min


If you want or need to set up your mail server to send all outgoing mail to a specific server that will handle the delivery to the recipients you need to set up an SMTP relay or smarthost.


  • You need to know the hostname of the SMTP server which is going to relay the mail for your mail server, which is in our case
  • This article assumes that no authentication is necessary on the SMTP relay server
  • This article is written for cPanel with Exim
  • You need to have the login details of WHM ready

Step 1: Login on WHM

Go to https://x.x.x.x:2087 (replace x.x.x.x with the IP address of your server).

Step 2: Add SPF include host

Within WHM navigate to: Main > Service Configuration > Exim Configuration Editor, in the Basic Editor search for “SPF include hosts for all domains on this system” and change the setting from “None” to ``. Click on “Save” at the bottom.

Step 3: Configure the MTA

On the same page (Main > Service Configuration > Exim Configuration Editor), click on the Advanced Editor button and search on the page for “Section: POSTMAILCOUNT” and add the following:

  driver = manualroute
  domains = ! +local_domains
  ignore_target_hosts =
  transport = dkim_remote_smtp
  route_list = *

If “Section: POSTMAILCOUNT” is not available proceed to step 4, otherwise proceed to step 5.

Step 4: IF “Section: POSTMAILCOUNT” is not available

On the same page search for “Section: ROUTERSTART” and add the following:

  driver = manualroute
  domains = ! +local_domains
  ignore_target_hosts =
  transport = dkim_remote_smtp
  route_list = *

Step 5: Save changes

Click on the “Save” button on the bottom of the page to save changes and restart the mail server to apply the new configuration.


Congratulations, you have set up an SMTP relay for your mail server.

Was this article helpful?
Dislike 4
Views: 32450

Reader Interactions


  1. Carlos says

    It is possible that some accounts relay to an SMTP and other accounts to another server, in the example given all the accounts will:

    the question is if I can have, for example, two SMTP servers and that mails can be routed from some accounts to one and those of the other account to others

    that is, have two SMTP relay or similar

  2. Danish says


    We have 2 cpanel servers, one is from amazon where we have hosted files and database for emails we want to use another machine.. I want to add other machine smtp settings in amazon server to send email. You have mentioned to add smtp relay but where we add authentication data?

    Please guide

Leave a Reply

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