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
Email authentication maintenance note
Email DNS changes should be handled like a launch task, not a quick copy-and-paste job. Before changing SPF, DKIM, DMARC, MX, or SMTP settings, record the current DNS values, confirm who sends mail for the domain, and keep a rollback note in case forms, invoices, password resets, or customer replies stop flowing.
Safe verification checklist
- Confirm there is only one SPF TXT record for the domain.
- Check that every active sender is included before tightening SPF or DMARC policy.
- Verify DKIM signing from the actual mail provider, not only that a DNS selector exists.
- Start DMARC in monitoring mode when you are not sure all senders are aligned.
- Send test messages to multiple mailbox providers and review headers before declaring the change finished.
Related email and DNS guides
- SPF Record For G-Suite
- SPF Record For MailChimp
- How to Create DMARC Records for Your Domain and Cross-Domain DMARC Records: A Comprehensive Guide
- Migrating cPanel Email Accounts Without Website Data: A Niche Yet Essential Guide
- How to Set Up DMARC and SPF Records for Your Domain
- Unleash the Power of Email Deliverability with Our SPF Generator
- DMARC Demystified—Secure Your Emails with Our DMARC Generator
- Double Trouble for Spammers—Using SPF and DMARC Generators Together
- WordPress Migration DNS and Email Cutover Checklist
- How to Fix WordPress Email Delivery with an SMTP Plugin
