The three parts of MTA-STS
v=STSv1; id=20261114120000id is a version marker. Every time the policy file changes, id must change, or senders will not fetch the new file.
version: STSv1 mode: testing mx: company-com.mail.protection.outlook.com max_age: 604800
The file is at https://mta-sts.company.com/.well-known/mta-sts.txt, and the host must have a valid certificate. mx lists the mail servers that are allowed to receive email for the domain. max_age is how many seconds the sender remembers the policy, at most 31,557,600, which is one year.
Three modes
| Mode | What the sender does |
|---|---|
testing | Delivers as usual, but reports failures through TLS-RPT. |
enforce | Does not deliver the email if encryption or the certificate fails, or if the server is not listed in mx. |
none | The policy is withdrawn. |
TLS-RPT
v=TLSRPTv1; rua=mailto:tls@company.comSenders that support it send a daily JSON report on how many deliveries were encrypted, and why the others failed. You read the reports with the TLS-RPT report reader.
A safe order
- Publish TLS-RPT first, so you get reports.
- Publish MTA-STS with
mode: testing. Create the record and the file with the MTA-STS generator. - Read the reports for a few weeks. Fix certificates and MX names that fail.
- Switch to
mode: enforce, and remember to changeidin the TXT record. - Check with the MTA-STS checker.
If you change email provider while the policy is at enforce, mx in the policy file must be updated first. Otherwise senders refuse to deliver to the new servers until they have fetched the new file.
MTA-STS or DANE?
DANE solves the same problem with TLSA records in DNS and requires DNSSEC. MTA-STS does not require DNSSEC, but a web address with https. They can be used together. You check DANE with the DANE checker.