Introduction
Email delivery is a critical aspect of any web hosting environment. WHM/cPanel, one of the most popular hosting control panels, offers various options for email delivery. This guide will walk you through configuring WHM/cPanel to use SendGrid, a cloud-based email delivery service, for all outgoing emails via Exim. This setup is especially useful for bypassing GoDaddy.com VPS Email Relay issues with UCEPROTECT.
Prerequisites
- Root access to your WHM/cPanel server.
- A SendGrid account with an API key.
Important Note on SPF Records
Before proceeding, make sure to update your SPF records to include SendGrid’s SPF record: include:sendgrid.net
. This is crucial for email deliverability and to ensure that your emails are not marked as spam.
Step 1: Log in to WHM
Access your WHM panel by logging in as the root user.
Step 2: Access Exim Configuration Manager
Navigate to Service Configuration
> Exim Configuration Manager
.
Step 3: Basic Editor
Once in the Exim Configuration Manager, go to the Basic Editor
tab.
Step 4: Add SendGrid Settings
Scroll down to the section labeled Section: AUTH
and add the following SendGrid settings:
sendgrid_login:
driver = plaintext
public_name = LOGIN
client_send = : apikey : Your_SendGrid_API_Key_Here
Step 5: Configure Routers
Scroll down to Section: ROUTERSTART
and add the following router settings:
send_via_sendgrid:
driver = manualroute
domains = ! +local_domains
transport = sendgrid_smtp
route_list = "* smtp.sendgrid.net::587 byname"
host_find_failed = defer
no_more
Step 6: Configure Transports
Scroll further down to Section: TRANSPORTSTART
and add the following transport settings:
sendgrid_smtp:
driver = smtp
hosts = smtp.sendgrid.net
hosts_require_auth = < $host_address
hosts_require_tls = < $host_address
Step 7: Save Changes
After adding all the necessary settings, click Save
at the bottom of the page to apply the changes.
Step 8: Restart Exim
Restart the Exim service to apply the new settings. This can be done either via the WHM interface or by running service exim restart
in the terminal.
Step 9: Test Email
Finally, send a test email to ensure that the new configuration is working as expected. If the email is successfully delivered, you’ve successfully configured WHM/cPanel to use SendGrid for all outgoing emails.
Conclusion
Configuring WHM/cPanel to use SendGrid for email delivery is a straightforward process that can significantly improve your email deliverability. By following this guide, you’ve taken a crucial step in ensuring that your emails reach their intended recipients without issues. Additionally, this setup allows you to bypass GoDaddy.com VPS Email Relay issues with UCEPROTECT, as you will no longer be using the Email Relay Servers that are being actively blocked.
Reference:
https://blog.sucuri.net/2021/02/uceprotect-when-rbls-go-bad.html