Enhanced Status Code 5.7.325: Certificate Hostname Mismatch
Enhanced Status Code 5.7.325 means “Certificate Hostname Mismatch.” The destination presented a valid, unexpired certificate that does not cover the hostname it was reached at. Under enforcement, a name mismatch is as fatal as an expired certificate.
550 5.7.325 certificate-host-mismatch: Remote certificate must have a common name or subject alternative name matching the destination host
What does 5.7.325 mean?
Microsoft returns 5.7.325 with the text certificate-host-mismatch, meaning the remote certificate must have a common name or subject alternative name matching the hostname being connected to, and does not. The certificate may be perfectly valid and current; it simply does not cover the name in the MX record.
This is a configuration mismatch rather than a certificate fault, and it is common after infrastructure changes. A domain adds a new MX host and points it at an existing server whose certificate covers the old name only. Or mail is moved behind a provider whose certificate covers the provider's own hostnames rather than the customer's. In both cases everything works for anyone not checking names, and fails immediately for anyone enforcing MTA-STS or DANE.
The fix at the destination is either to reissue the certificate with the MX hostname included as a subject alternative name, or to change the MX records to a hostname the existing certificate already covers. Both are straightforward once identified, and neither is something a sender can do.
How 5.7.325 plays out
5.7.325 rejectionWhere 5.7.325 sits: soft vs hard bounce
| Soft bounce (4xx) | Hard bounce (5xx) | |
|---|---|---|
| Nature | Temporary | Permanent |
| SMTP class | 4xx | 5xx |
| What to do | Let it retry | Suppress the address |
| Recoverable? | Often | No |
| 5.7.325 is | ✓ this code |
What each provider means by 5.7.325
A registered code does not oblige a provider to use it that way, and the large ones diverge. Match the wording in your own bounce, not the definition above.
Common causes of 5.7.325
- The MX hostname is not listed in the certificate common name or subject alternative names
- A new MX host was added without the certificate being reissued to cover it
- Mail was moved to a provider whose certificate covers only its own hostnames
- The certificate covers the bare domain but the MX points at a subdomain
- A wildcard certificate does not cover the depth of the MX hostname
- A load balancer presents a certificate for a different name than the MX record
How to fix 5.7.325
- Do not suppress the recipient, since the address is valid and the fault is their configuration
- Tell the receiving organisation which hostname their certificate needs to cover
- Read the certificate with openssl s_client and compare its names to their MX records
- Check every MX host, since only one may be mismatched
- Do not disable enforcement to work around a name mismatch
- Where you host mail yourself, ensure every MX hostname is a subject alternative name