Configuring your Cpanel/WHM managed domain to use SendGrid’s SMTP mail servers is quite easy.You will need root access to do this.

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

  4. Find a section called Section: AUTH a(You may want to use the “find” function of your browser to find it since this configuration file is rather large). The section will be empty. Paste the following into the text box, replacing “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 put in an asterick in place of “Yourdomainhere”, for example “*@*” :
    driver = manualroute
    domains = ! +local_domains
    senders = *@<YourDomainHere>
    transport = sendgrid_smtp
    route_list = "* byname"
    host_find_failed = defer

  6. Find the section called Section: TRANSPORTSTART and paste the following in the textbox:
    driver = smtp
    hosts =
    hosts_require_auth =
    hosts_require_tls =

Save the file, and exim will restart. That’s all there is to it, you should now be able to send emails with no problem and it will all automatically route through your sendgrid account. You can cehck by logging into shell and running tail -f /var/log/exim_mainlog. You will see the emails going through your sendgrid. Thank you!