Encryption between mail servers depends on certificates, and certificates expire. A lapsed certificate on a submission port makes mail clients and applications refuse to connect; on a receiving server, it can make strict senders defer or bounce mail when they require validated TLS. Unlike many technical faults, an expired certificate is entirely predictable, and yet it remains one of the common causes of mail outages. This guide explains what a mail server certificate must contain, how receivers and clients validate it, how to obtain and install it, how to automate renewal, how MTA-STS and DANE change the stakes, and how to monitor and troubleshoot. For the client-side error messages, see SMTP certificate errors and TLS troubleshooting.
Who checks the certificate and how
| Connection | Typical validation | Consequence of a bad certificate |
|---|---|---|
| Mail client or application to submission port (587 or 465) | Full validation: trusted chain, matching name, valid dates | Connection refused or warning; sending stops |
| Server to server on port 25, default | Opportunistic: most senders accept any certificate, expired or not, to keep mail flowing | Mail continues, but without real protection |
| Server to server with MTA-STS enforce | Validated chain and name match required. See MTA-STS | Mail is deferred or fails to MTA-STS-aware senders |
| Server to server with DANE | Certificate must match TLSA records. See DANE for SMTP | Mail is deferred to DANE-aware senders if it does not match |
| IMAP and POP clients | Full validation | Clients stop fetching mail |
What the certificate must contain
- The right names. The Subject Alternative Name list must include every hostname that clients or senders use to reach the server: the MX target (
mx1.example.com), the submission hostname (smtp.example.com) and, for MTA-STS, the names listed in the policy. A certificate forwww.example.comonly will not match. - Wildcards (
*.example.com) cover one label. They are convenient but widen the damage if the key leaks. - Server authentication usage. The certificate must permit server use, which public authorities do by default.
- A trusted issuer. For public mail, use a certificate from a widely trusted authority. Private authorities work only inside organisations that distribute the root.
- Key strength. RSA 2048 bits or an ECDSA P-256 key are common; follow your authority's and your policy's requirements.
- Validity dates. Public certificates have limited lifetimes that have been getting shorter; plan for frequent renewal.
Obtaining and installing
- Generate a private key on the server (or in a managed key store) and create a certificate signing request that lists the names.
- Choose an authority. Free automated authorities using the ACME protocol are widely used for mail; commercial authorities offer longer support terms.
- Prove control of each name. For HTTP validation the mail host needs a web endpoint; for DNS validation you add a TXT record, which works for hosts without a web server. See DNS records for email.
- Install the full chain file (leaf plus intermediates) in the order the mail software expects.
- Point the mail software at the new files, reload it and confirm with a test connection.
# Inspect what a server presents, including the chain and expiry
openssl s_client -starttls smtp -connect mx1.example.com:25 -servername mx1.example.com -showcerts </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates -ext subjectAltNameThe -servername option sends SNI, which matters when one IP address serves several hostnames. Test both with and without it, because some servers present a default certificate when SNI is missing, and some senders do not send SNI.
Automated renewal
- Use an ACME client with a scheduled job, and renew well before expiry (for example when thirty days remain on a ninety-day certificate).
- Run a deploy hook that copies the new files and reloads the mail service. Many outages happen because the file was renewed but the process kept the old certificate in memory.
- Restrict permissions on private keys and avoid keeping copies in backups with wide access.
- If several servers share a name, make sure all receive the new certificate, or use a central store.
- Test the process on a staging host and by forcing a renewal before the first real one.
Common problems
| Problem | Cause | Fix |
|---|---|---|
| Name mismatch | Certificate does not list the MX or submission hostname | Reissue with correct SANs |
| Incomplete chain | Intermediate certificate missing | Install the full chain; check with an online or openssl test |
| Expired certificate | Renewal failed or service not reloaded | Fix automation and add monitoring |
| Different certificate per port | Ports 25, 465 and 587 configured separately | Update all listeners |
| Old TLS versions or weak ciphers | Outdated configuration | Support TLS 1.2 and 1.3 only, and modern ciphers |
| Wrong certificate by SNI | Default virtual host serves the wrong certificate | Configure SNI maps properly |
| DANE mismatch after renewal | TLSA records still point to the old key | Roll TLSA records before changing keys; use the 3 1 1 form if possible |
| Clock skew | Server time wrong | Run time synchronisation |
Special cases
Several situations deserve their own attention. Servers behind a load balancer need the same certificate on every node, and the balancer itself may terminate TLS, so check which device presents the certificate to the world. Hosted mail from a provider usually handles certificates for you, but custom domains used for tracking, images or return paths may need their own certificates. Mail servers that serve many customer domains often present one certificate for the server name and rely on policies, not per-domain certificates, for validation. If you use client certificates for authentication between systems, track their expiry too, because they fail silently in the same way.
Finally, test the failure case on purpose. In a staging environment, install an expired or mismatched certificate and see what your applications do: some fail loudly, others retry for hours, and a few quietly fall back to unencrypted mail, which you should never allow. Knowing the behaviour in advance turns an outage into a known procedure.
Monitoring
Check expiry from the outside, as senders see it, not just from the file on disk. Probe every hostname and port: 25, 465, 587 and any IMAP or POP ports. Alert at several thresholds (30, 14 and 7 days), send alerts to people and not only to a shared mailbox, and include certificate checks in your runbook. Watch TLS reports from MTA-STS, which tell you when senders fail to validate your certificate. Track certificate transparency logs for unexpected issuance for your domains. See delivery monitoring and DNSSEC and CAA for control over who may issue.
Rotation and key hygiene
- Rotate keys on renewal where policy allows; reuse of a key is acceptable only if your policy says so.
- Revoke and replace certificates immediately if a private key is exposed.
- Keep an inventory of certificates with owner, hostnames, issuer, expiry and renewal method.
- Document emergency steps: who can issue, where files live, how to reload services.
A mail certificate is routine maintenance that becomes an incident only when nobody owns it. Automate issuance, verify the live result from outside, and keep monitoring simple and loud.
Run mail on a managed, monitored platform Let us handle TLS for your sending infrastructure.
References and further reading
Frequently asked questions
Which names must an SMTP certificate cover?
Every hostname used to reach the server: MX targets, the submission hostname and any names in your MTA-STS policy.
Does an expired certificate stop incoming mail?
Often not for ordinary port 25 traffic, but senders using MTA-STS enforce or DANE will defer mail, and client connections will fail.
Why does the old certificate still appear after renewal?
The mail service was not reloaded. Add a deploy hook that reloads it.
Can I use a wildcard certificate for mail?
Yes, if it covers the hostnames, but weigh the wider impact of a leaked key.
How do I test what the server presents?
Use openssl s_client with -starttls smtp and -servername, then read the chain and dates.