How to setup Sendgrid on your cPanel VPS/Server

One of our clients asks to Configure his  Cpanel/WHM VPS to use SendGrid’s SMTP mail servers. which is quite easy:

  1. Login to your VPS or server using your root login credentials
  2. Service Configuration -> Exim Configuration Manager
  3. Then click the “Advanced Editor” ta

4. Find a section called Section: AUTH. The section will be empty. Paste the following code into the text box and replace “YourSendGridUsername : YourSendGridPassword” with your real sendgrid username and password

driver = plaintext
public_name = LOGIN
client_send = : YourSendGridUsername : YourSendGridPassword

5. Find the section called Section: PREROUTERS paste the following in the textbox, replacing “*@Yourdomainhere” with your domain. If you want to cover the entire server, then use (! +local_domains) in place of “Yourdomainhere”, for example:

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

6. Find the section called Section: TRANSPORTSTART and paste the following code into the text box:

driver = smtp
hosts =
hosts_require_auth =
hosts_require_tls =

Save this configuration and exim will restart. you should now be able to send emails without any issue and it will all automatically route through your sendgrid account. That’s all we have to do.