Get your free beta license ↗
Mail · Dovecot

A mail client warns that the certificate is for another name

Last updated 30 Nov 2026
Summary

A mail client connecting to mail.example.com warns that the certificate is for another name, the server's hostname. Dovecot and Postfix use the domain's certificate only if it covers the requested name, so point the name at this server and issue the certificate again.

Symptoms

A mail client set to mail.example.com warns of a certificate name mismatch. The certificate it shows is issued for the server's hostname.

Check which certificate the server presents for mail.example.com.

openssl s_client -connect mail.example.com:993 -servername mail.example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName
Output
subject=CN=server.example.net
X509v3 Subject Alternative Name: 
    DNS:server.example.net

Cause

For mail.example.com and webmail.example.com, Dovecot and Postfix present the domain's certificate if it covers the requested name or includes *.example.com. Otherwise, they present the server's certificate, which covers its hostname.

When this server handles a domain's mail, UrbeStack requests both names on the domain's certificate. Before requesting the certificate, UrbeStack checks that each name resolves to this server. It leaves off any name that fails that check, such as mail.example.com when its DNS record still points to an old server.

Resolution

  1. Check that mail.example.com resolves to this server's IP address.

    dig +short mail.example.com
  2. Correct the DNS record if it points elsewhere, then issue the domain's certificate again.

    urbestack-cert-issue --name example.com --force
  3. UrbeStack gives Dovecot and Postfix the new certificate. Run the openssl command from Symptoms again. The certificate names now include mail.example.com.

  4. You can also set the mail client to use the server's hostname, which the server's certificate covers.