A self-signed certificate on mail.example.com works fine until a user’s iPhone gets an iOS update and refuses to connect. Replacing it with Let’s Encrypt is straightforward conceptually — cPanel ships AutoSSL — but the cert needs to cover both the server hostname and every customer domain’s mail.example.com subdomain, and the cert that Exim and Dovecot present must match what the client connected to. Getting all those bindings right is where operators stumble.
What’s happening
cPanel’s AutoSSL feature periodically issues Let’s Encrypt (or Sectigo) certificates for accounts. By default it covers the main domain and www.. Mail subdomains need to be added explicitly to the AutoSSL coverage list, and the server’s own hostname (the FQDN reported by hostname) needs a separate certificate. Exim and Dovecot read the cert from the Service SSL directory, not from the customer SSL — so installing a cert on the customer’s mail.example.com website doesn’t automatically apply to SMTP/IMAP.
How to verify
Check the active certs for the server hostname and a mail subdomain:
openssl s_client -connect mail.example.com:993 -showcerts < /dev/null 2>&1 | grep "subject="
openssl s_client -connect mail.example.com:465 -showcerts < /dev/null 2>&1 | grep "subject="
Then check what cPanel’s Service SSL configuration shows:
whmapi1 fetch_service_ssl_components
A “default” cert in the output means the hostname is using a self-signed; you need to install a real cert there.
The fix
-
Confirm AutoSSL is enabled in WHM > AutoSSL. The Sectigo or Let’s Encrypt provider should be active. AutoSSL runs daily; force a run with
/usr/local/cpanel/bin/autossl_check --all-users. -
Cover mail subdomains in AutoSSL by ensuring the customer’s account includes the
mail.subdomain in their DNS zone. AutoSSL discovers subdomains automatically if DNS and HTTP validation work for them. -
Install a real cert for the cPanel server hostname. WHM > Manage Service SSL Certificates. Use AutoSSL for the hostname (it’s a separate cert from the customer accounts). If the hostname isn’t covered by Let’s Encrypt because of DNS, install a manual cert.
-
Restart Exim and Dovecot after cert changes to pick up the new files:
/scripts/restartsrv_exim /scripts/restartsrv_dovecot -
Confirm SNI works if multiple mail subdomains share one IP. Modern Exim and Dovecot support SNI — each domain’s connection presents its own cert. Test with the openssl commands above against each customer hostname.
-
Set up alerting for cert expiry. AutoSSL renews automatically, but a misconfigured DNS or a removed subdomain can stall renewal silently. A simple cron that runs
openssl s_clientand checks the notAfter date catches this.
For environments where cert lifecycle has to be automatic across dozens of cPanel domains, Stack Harbor maintains the AutoSSL coverage list and the Service SSL bindings as part of cPanel server management.