Bounce code · Permanent

5.7.321: The recipient's server failed a TLS check (Microsoft 365)

The recipient's mail server failed a security check that Microsoft 365 requires, such as TLS support, a valid certificate or DANE. It is permanent: your server does not retry it. Tell the recipient's admin, who must fix the server or its DNS records.

How to fix itEvery bounce code

PermanentSecurity or policy status

5.7.321

What happens
Not retried
Registry name
Not in the IANA registry
Who uses it
Microsoft (Exchange Online)

At a glance

  • Type: permanent failure (class 5, RFC 3463 §2). The sending server does not retry it and reports the failure to the sender: a bounce message, or an error in the mail app.
  • Basic code: varies; the enhanced code is the part that identifies the problem.
  • Enhanced code 5.7.321: not in the IANA registry; the group is security or policy status (RFC 3463 §3.8).
  • Who uses it: Microsoft (Exchange Online): starttls-not-supported (5.7.321), certificate-expired (5.7.322), tlsa-invalid (5.7.323), dnssec-invalid (5.7.324), certificate-host-mismatch (5.7.325).
  • Also on this page: 5.7.322, 5.7.323, 5.7.324, 5.7.325, 4.7.322, 4.7.323, 4.7.324, 4.7.325.

A 5.7.321 to 5.7.325 bounce from Microsoft 365 means the recipient's domain asks for secure delivery, and its mail server failed one of the checks. Microsoft 365 will not hand the message over until the check passes.

What it means

These are Microsoft's own codes. The IANA registry ends its X.7 list at X.7.30. Microsoft's Exchange Online NDR reference and its page on how SMTP DANE works give each one a short name:

  • 5.7.321 starttls-not-supported: the server did not answer the STARTTLS command, or the TLS handshake failed.
  • 5.7.322 certificate-expired: the server presented an expired certificate.
  • 5.7.323 tlsa-invalid: the domain failed DANE validation. The certificate may not match the domain's TLSA record, the record may be wrong, or the domain may be under attack.
  • 5.7.324 dnssec-invalid: the domain signals DNSSEC, but Exchange Online could not verify its records.
  • 5.7.325 certificate-host-mismatch: the names in the certificate match neither the domain nor the MX host.

DANE lets a domain publish, in DNSSEC-signed DNS, which certificate its mail servers use. Microsoft's DANE page says Exchange Online checks it on outbound mail by default, whenever the destination domain advertises DANE support. A domain with no TLSA record gets no DANE checks.

4.7.321 to 4.7.325 are the same failures reported as temporary. Microsoft's DANE page says Exchange Online runs a failed check again after 15 minutes, again 15 minutes later, then every hour for 24 hours. If it still fails, the message expires and the sender gets a bounce. Microsoft also notes that a DNSSEC failure can show up as a generic 5.4.312 DNS query failed instead of 5.7.324.

Common causes

  • The server's certificate expired and was not renewed.
  • The certificate was replaced, but the TLSA record still describes the old one.
  • The TLSA record or the domain's DNSSEC signing is set up wrong.
  • The certificate's names do not include the MX host name.
  • The server stopped offering STARTTLS, or its TLS setup is broken.

How to fix it

If you are the sender:

  1. Check that the recipient's domain is the one you meant, as Microsoft suggests first. A typo in the domain sends the mail to someone else's servers.
  2. Tell the recipient's admin by another channel and give them the full error text.
  3. Allow them time to fix it, then send again.

If you run the recipient's domain:

  1. For 5.7.322, publish a TLSA record for the new key next to the old one, wait at least two TTLs, then switch to the new certificate (RFC 7671 §8.1). A 3 1 1 record matches the public key, so it still matches after a renewal that keeps the same key.
  2. For 5.7.323 and 5.7.325, compare the certificate with the TLSA record and the MX host names.
  3. For 5.7.324, check the domain's DNSSEC signing with your DNS provider.
  4. For 5.7.321, make sure the server offers STARTTLS and completes the handshake.
  5. Set up TLS-RPT to receive reports of these failures from senders. Our MTA-STS and TLS-RPT guide shows how.

What to do with the address

Keep it, but hold further sends until the admin fixes the server. The recipient address is not the problem. Its server failed a security check, and that says nothing about the mailbox.

The address on your list is not what failed here. For the bounces your list does cause, clean the list before you send.

Get up to 500 free credits. No card needed.

Fewer bounces start with a clean list: check addresses before you send.

Updated · Maintained by: Email Validation LLC