An expired certificate on a mail server often goes unnoticed for days, because most monitoring stacks only check HTTPS on port 443 and nobody looks at SMTP, IMAP or submission ports until users start complaining. This article explains how monitoring TLS certificates on mail servers and STARTTLS ports actually works, which ports and protocols need checks, how to test them from the command line, and which renewal mistakes keep causing mail outages. The goal is simple: find a broken mail certificate before Outlook, Thunderbird or a partner’s MTA finds it for you.
Why Mail Certificates Slip Through the Cracks
Web certificates get attention because a browser warning is visible to everyone. Mail certificates fail more quietly. A broken certificate on IMAP shows up as a vague “cannot verify server identity” popup on a few laptops, and the help desk usually blames the client first.
The bigger problem is architecture. The certificate on Postfix, Exim, Dovecot or Microsoft Exchange is often a separate copy of the web certificate, loaded by a different daemon with its own reload cycle. Certbot renews the files on disk, nginx reloads through a deploy hook, and Postfix keeps serving the old certificate from memory until someone runs postfix reload. Your HTTPS monitor shows green the whole time.
Which Mail Ports Need TLS Certificate Monitoring
A mail host usually exposes several TLS endpoints, and they don’t all behave the same way. Some use STARTTLS, where the connection starts in plaintext and upgrades after a protocol command. Others use implicit TLS, where the handshake happens straight away, just like HTTPS. A complete check covers:
Port 25 (SMTP, STARTTLS) – server-to-server delivery to your MX hosts.
Port 587 (submission, STARTTLS) – authenticated clients sending mail.
Port 465 (submissions, implicit TLS) – back in favour since RFC 8314 in 2018.
Ports 143 and 993 (IMAP) – STARTTLS and implicit TLS respectively.
Ports 110 and 995 (POP3) – still around on older setups and ISP-hosted mailboxes.
A generic HTTPS checker pointed at port 25 just times out or reports a protocol error. It has to speak enough SMTP to send EHLO, see STARTTLS advertised, issue the command and then start the handshake. That’s why mail endpoints need STARTTLS-aware checks, not just a port number added to an existing web monitor.
Testing STARTTLS Certificates from the Command Line
Before automating anything, an experienced mail administrator checks each endpoint by hand with OpenSSL. For SMTP on an MX host:
openssl s_client -connect mx1.example.com:25 -starttls smtp -servername mx1.example.com
Pipe the output into openssl x509 -noout -dates -subject -ext subjectAltName to get the expiry date and the names the certificate covers. Swap -starttls smtp for -starttls imap or -starttls pop3 on the other STARTTLS ports, and leave the flag off completely for 465, 993 and 995. More OpenSSL techniques are covered in checking certificate health from the command line.
When you run these tests, check three things. First, does the hostname in your MX record appear in the certificate’s SAN list? Second, is the full intermediate chain being sent? Dovecot and Postfix both serve exactly what the file contains, so a leaf-only cert.pem instead of fullchain.pem is a classic mistake. Third, which TLS versions does the server accept? TLS 1.0 and 1.1 should be off.
A Realistic Failure Scenario
Picture a small company on a self-hosted Postfix and Dovecot box. Let’s Encrypt renews the certificate every 60 days through certbot, and the deploy hook reloads nginx only. Renewal succeeds on a Thursday. The old certificate expires 30 days later, on a Saturday.
On Monday morning the iOS Mail and Outlook users can’t fetch mail, because IMAP on 993 is still serving the expired certificate. Inbound mail on port 25 keeps arriving, which makes the whole thing confusing. Diagnosis takes about two hours: the web monitor shows a valid certificate, and the files on disk are valid too. The fix is one command – systemctl reload postfix dovecot – plus a corrected deploy hook.
The Opportunistic TLS Myth
A common belief is that an expired or mismatched certificate on your MX will cause other servers to bounce your incoming mail. Usually it doesn’t. SMTP between servers uses opportunistic TLS, and most sending MTAs don’t validate the certificate at all, or they fall back to plaintext when the handshake fails. That silent fallback is exactly what makes port 25 failures dangerous: mail keeps flowing, but in cleartext or over unauthenticated encryption, and nobody gets an error.
That changes once you publish MTA-STS (RFC 8461) in enforce mode or DANE TLSA records (RFC 7672). Gmail, Microsoft 365 and other senders that honour these policies will then refuse delivery to an MX with an invalid certificate. Strict policies are a good thing, but they make certificate monitoring mandatory. How deliverability suffers from this is covered in more depth in how expired certificates affect email deliverability.
Common Mistakes in Mail Server Certificate Management
Rotating keys under DANE. A TLSA record of type 3 1 1 pins the public key hash. Certbot generates a new private key on every renewal unless you use –reuse-key. Renew without updating DNS first, and every DANE-validating sender (Postfix with DANE enabled, many European providers) will defer your mail. The safe approach is to publish the new TLSA record alongside the old one at least two TTLs before the switch.
Forgetting the MTA-STS policy host. The policy file is served over HTTPS from mta-sts.example.com. If that web certificate expires, senders can’t fetch updated policies. Cached policies cover the gap until max_age runs out, often 604800 seconds (one week), and after that enforcement can break unpredictably.
Monitoring only the primary MX. Backup MX hosts with priority 20 or 30 are often forgotten VMs with certificates nobody renews. They only take traffic when the primary is down, which is exactly the worst moment to discover the problem.
Edge Cases Worth Planning For
Outbound port 25 is blocked by default on AWS EC2, Google Cloud and Azure in many account types. A monitoring probe running there will report your MX as unreachable when the real problem is the probe’s network. Run SMTP checks from a host that’s allowed to make outbound port 25 connections.
Exchange Server adds another layer. The certificate has to be bound to the SMTP service with Enable-ExchangeCertificate -Services SMTP, and the internal transport certificate is a separate thing from the IIS one. On Microsoft 365 or Google Workspace, Microsoft and Google manage the MX certificates themselves, so you only need to watch the MTA-STS host and any on-premises relays or hybrid connectors.
Validity periods are also getting shorter. Under CA/Browser Forum ballot SC-081, maximum lifetimes fell to 200 days in March 2026 and drop to 100 days in March 2027. More renewals mean more chances for a daemon to miss a reload. When a handshake fails anyway, the patterns described in understanding SSL handshake failures help narrow down the cause quickly.
FAQ
Do I need to monitor both port 587 and port 465?
Yes, if both are open. They often share one certificate but are configured separately in Postfix’s master.cf, so one can be misconfigured while the other works fine.
Is it enough to check the certificate file on disk?
No. Daemons cache certificates in memory. Only a live handshake against the port shows what clients actually receive.
How far in advance should mail certificate alerts start?
Start at 30 days, with escalation at 14, 7 and 1 day. If you use DANE, add extra lead time so TLSA records can be published before any key rotation.
Final Practical Tip
List every mail hostname and port, including backup MX hosts and the MTA-STS policy host, and check each one with a live STARTTLS or implicit TLS handshake, not a file check. Then add a reload for every TLS-consuming daemon to your renewal deploy hook, not just the web server. Most mail certificate outages come down to that one missing reload line.
