Integrate Sendgrid into WHM. SMTP Integration to WHM.

If you this does not work first time, request to try again…

Setting up your cPanel server to send through a third-party mail server is very easy to do, if you understand the basics of how cPanel builds its Exim configs. You never want to edit your exim.conf file directly – your changes will be wiped out any time a cPanel update runs or someone makes a change via the Exim Configuration Editor in WHM.  Below is a quick guide on setting up a custom mail router with a provider like SendGrid, which in turn will route all outbound email through the external mail service.

The below instructions cover how to do this via command line.  If you prefer WHM, simply go to WHM -> Exim Configuration Manager -> Advanced Editor and alter the sections indicated.

First, open up your /etc/exim.conf.local file in an editor and look for the @AUTH@ section.  Modify it to look like this:


driver = plaintext
public_name = LOGIN
client_send = : <user> : <password>


Of course, replace <user> with your SendGrid username and <password> with your SendGrid account password.  If you already have something in the AUTH section, simply add this block of text below it.

Now look for the @PREROUTERS@ section, and modify it to look like this:


driver = manualroute
domains = ! +local_domains
transport = sendgrid_smtp
route_list = "* byname"
host_find_failed = defer


The last modification should be to the @TRANSPORTSTART@ section:


driver = smtp
hosts =
hosts_require_auth =
hosts_require_tls =


Now save the file, and apply the changes:


service exim restart

Was this article helpful?

Related Articles