How to Correct Email SSL Hostname in cPanel Interface

Users in cPanel have the convenient option of automatically setting up their mail clients using a downloaded setup file, or the printed list of configurable values that displays in the cPanel interface under Mail -> Email Accounts -> Configure Email Client.  If you’re offering secure email services under a specific SSL hostname for the user to connect to, there are times where the Configure Email Client hostname may be incorrect.  This is especially true if you are using a wildcard SSL certificate for service SSL access, which will cause this feature to default to the server’s hostname.

To correct this, all you need to do is edit the following files in /var/cpanel/ssl:

  • courier-imapd-DOMAINS
  • courier-pop3d-DOMAINS
  • exim-DOMAINS
  • dovecot-DOMAINS


The files should contain the secure hostname that you want your customers to use when accessing email over SSL.  To make this simpler, you can use the following script:

SSL_HOST=secure.hostname # Replace this with the desired hostname
SERVICES=(courier-imapd courier-pop3d exim dovecot)
for file in ${SERVICES[@]}
echo $SSL_HOST >  /var/cpanel/ssl/$file-DOMAINS

Save the above script into a file, set the permissions to 755, and run it normally.