One of our clients asks to Configure his Cpanel/WHM VPS to use SendGrid’s SMTP mail servers. which is quite easy:
- Login to your VPS or server using your root login credentials
Service Configuration -> Exim Configuration Manager - 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
sendgrid_login: 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:
send_via_sendgrid: driver = manualroute domains = ! +local_domains transport = sendgrid_smtp route_list = "* smtp.sendgrid.net::587 byname" host_find_failed = defer
6. Find the section called Section: TRANSPORTSTART and paste the following code into the text box:
sendgrid_smtp: driver = smtp hosts = smtp.sendgrid.net hosts_require_auth = smtp.sendgrid.net hosts_require_tls = smtp.sendgrid.net
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.