Tutorial How to use SendGrid as a Smarthost

*** This guide is a task intended for system administrators. cPanel's Technical Analysts cannot provide assistance in configuring a server's Smarthost setup. ***

Many providers now block outbound connections on port 25, which means that a cPanel system would need to configure a Smarthost to allow for outbound emails to function. This resource will go through how to setup a Smarthost using a common 3rd party mail provider, SendGrid.

Note: Click here to read the corresponding resource for setting up a smarthost with MailGun.

It is important to note that configuring a Smarthost will cause all outbound emails to go through the configured provider. The scope of this resource does not cover only having certain domains go through a Smarthost. That would be something that must be configured by the system administrator of the server.

SendGrid has a free plan which allows for 40,000 emails to be sent through their system within the account's first 30 days. After the 30 days have concluded, the free plan would only allow 100 emails per day.

1. The first step will be to sign up here if you have not already done so.

2. The next step will be to log in to WHM as the root user. Once logged in, navigate to WHM > Service Configuration > Exim Configuration Manager > Advanced Editor. On this page, search for "Section: AUTH". In the text box, input the following:

  driver = plaintext
  public_name = LOGIN
You must replace "YOUR-SENDGRID-USERNAME" and "YOUR-SENDGRID-PASSWORD" with your actual SendGrid username and password. EX:

client_send = : myusername:mypassword
Here's an image showing an example of how this should look:


3. Now go to the "Section: PREROUTERS" section and input the following in the text box:

  driver = manualroute
  domains = ! +local_domains
  transport = sendgrid_smtp
  route_list = "* byname"
  host_find_failed = defer
Here's an image showing an example of how this should look:


4. The last configuration that will need to be set will be for "Section: TRANSPORTSTART". Add the following into its text box:

  driver = smtp
  hosts =
  hosts_require_auth = <; $host_address
  hosts_require_tls = <; $host_address
Here's an image showing an example of how this should look:


5. Navigate to the bottom of the page and click "Save". This will save the changes that have been made, and automatically restart the Exim service.

6. Now try sending a test email, preferably from one of the Webmail applications, and verify that it was received. If the email gets queued on the server, then the /var/log/exim_mainlog file will need to be examined to determine the cause of the issue.

Feel free to click on the Discussion tab to let us know if you have any questions or feedback about the information in this tutorial.

Admin Note:
This cPanel staff tutorial is no longer being maintained/updated here. For the most recent/up to date version please go here: How to use SendGrid as a Smarthost
First release
Last update
0.00 star(s) 0 ratings