You can use SendGrid as a smarthost to send emails from your cPanel server. To allow SengGrid to send outgoing emails from your cPanel/ WHM server You would require to setup exim server on your cPanel/WHM server.
What is SendGrid?
SendGrid is a cloud-based SMTP provider that allows you to send email without having to maintain email servers. SendGrid manages all of the technical details, from scaling the infrastructure to ISP outreach and reputation monitoring to whitelist services and real time analytics.
Sendgrid offer free plan to send 40,000 emails once you register with sendgrid and allow to send 100 emails/day afterward . You can upgrade plan as per your requirements
How to setup SendGrid in WHM/ cPanel ?
1. Once you signup or you already have SengGrid Account, create SendGrid API key and allow Mail permissions to your API key.
2. Log in to your WHM as the root user, navigate to Home » Service Configuration » Exim Configuration Manager » Advanced Editor . search for “Section: AUTH” and input the following string in text box:
driver = plaintext
public_name = LOGIN
client_send = : apikey : YOUR-SENDGRID-API-KEY
Please make sure to replace “YOUR-SENDGRID-API-KEY” with API key you generated under your SendGrid account (and allow Mail permissions).
3. In Exim Advanced Editor, search for the the “Section: POSTMAILCOUNT” box, and input the following in the text box:
driver = manualroute
domains = ! +local_domains
transport = sendgrid_smtp
route_list = “* smtp.sendgrid.net::587 byname”
host_find_failed = defer
4. Add the following into the “Section: TRANSPORTSTART” text box:
driver = smtp hosts = smtp.sendgrid.net
hosts_require_auth = <; $host_address
hosts_require_tls = <; $host_address
5. Scroll down to bottom of the page, and click on “Save” button to apply changes.
This will save the changes you applied and it will automatically restarts the Exim service.
6. Now try sending a test email, preferably from one of the Webmail applications or from any cPanel account web mail interface to verify.
If you see emails are stuck in mail queue of server, you need to check the /var/log/exim_mainlog file to find the reason .