Configure cPanel Exim 4 to Relay Outbound Email Using SendGrid

Issue: Email reputation is quickly becoming a dominant facet effecting deliverability of email. SendGrid, among several, is an email service that offers features such as validation, analytics, and so on, and has other features to help improve your email reputation. In this example a server is using Exim with cPanel.

Solution: Configure Exim to use SendGrid (in a sense like a Smarthost).

Log into WHM and (in the left sidebar) navigate to:

Service Configuration >> Exim Configuration Manager >> Advanced Editor (tab)

Search for “Section: AUTH” (it may be empty) and enter the following:

[sourcecode language=”plain”]begin authenticators
sendgrid_login:
driver = plaintext
public_name = LOGIN
client_send = : SendGridUsername : SendGridPassword[/sourcecode]

Note: Substitute SendGridUsername and SendGridPassword with your working SendGrid credentials. Also the “begin authenticators” directive should only be included in that box once.

Search for “Section: PREROUTERS” and enter the following:

send_via_sendgrid:
driver = manualroute
domains = ! +local_domains
transport = sendgrid_smtp
route_list = "* smtp.sendgrid.net::587 byname"
host_find_failed = defer
no_more

Search for “Section: TRANSPORTSTART” and enter the following:

sendgrid_smtp:
driver = smtp
hosts = smtp.sendgrid.net
hosts_require_auth = <; $host_address
hosts_require_tls = <; $host_address

Save the configuration (which will restart Exim).

Outbound email will now route through SendGrid.

1 thought on “Configure cPanel Exim 4 to Relay Outbound Email Using SendGrid”

Leave a comment

BlogLogistics