Email travels from server to server over SMTP. Encryption between servers is separate from authenticating who sent a message (SPF, DKIM and DMARC, see How Email Authentication Works: SPF, DKIM and DMARC). STARTTLS upgrades a plain SMTP connection to TLS, but senders accept a failed upgrade silently, so an attacker can strip it. MTA-STS (RFC 8461) lets a domain say that its mail must be delivered over verified TLS. Build the records with the MTA-STS Policy Generator; the glossary entry is MTA-STS, and reply codes are in SMTP Reply Codes Cheat Sheet.
The weak link: opportunistic STARTTLS
- Port 25 server-to-server delivery starts in plain text; the sender asks for
STARTTLS, and if the answer is missing or TLS fails, it usually delivers unencrypted anyway. - Certificates are often not checked, so even a successful upgrade may not stop a man in the middle.
- Ports 465 (implicit TLS) and 587 (submission with STARTTLS) are for your own mail client, not for server-to-server delivery.
MTA-STS in three pieces
- A DNS TXT record at
_mta-sts.example.comsignals that a policy exists:v=STSv1; id=20261028T000000Z. Change theidwhenever the policy changes. - A policy file served over HTTPS at
https://mta-sts.example.com/.well-known/mta-sts.txt:
version: STSv1
mode: enforce
mx: mail.example.com
mx: *.example.net
max_age: 604800
- The policy lists the allowed MX hosts, the mode (
testing,enforceornone) and how long senders may cache it (max_age, in seconds; 604800 is one week).
TLS-RPT: find out when it fails
A TLS-RPT record (RFC 8460) asks sending servers to report failures. Publish a TXT record at _smtp._tls.example.com: v=TLSRPTv1; rua=mailto:[email protected]. Daily JSON reports then show which senders could not negotiate TLS or validate your certificate.
Rolling it out
- Start in
testingmode with a shortmax_ageand watch the TLS reports. - Make sure every MX host has a valid, unexpired certificate whose name matches the MX host name (see How to Check an SSL Certificate).
- Move to
enforceand raisemax_age(a week, then months). - MTA-STS protects delivery to your domain only if senders support it; DANE (TLSA records with DNSSEC) is an alternative.