Symptoms
Accessing webmail via https://mail.mydomain.com generates an SSL error because the hostname SSL is used.
Description
The SNI (Server Name Indication) configuration for a domain is not added until it is needed. So this SSL mismatch will occur if the domain does not have any emails added yet.
Workaround
Add an email account under the domain in the following location of cPanel.