MTA-STS step by step

Mail between servers is encrypted only if both sides agree, and an attacker in the middle can make them agree not to. MTA-STS lets you publish a policy that tells sending servers to insist on a valid, encrypted connection to your MX hosts.

1. Host the policy file

Serve a plain text file at exactly https://mta-sts.example.com/.well-known/mta-sts.txt, with a certificate valid for mta-sts.example.com:

mta-sts.txt
version: STSv1
mode: testing
mx: mail.example.com
mx: *.mail.protection.outlook.com
max_age: 604800

List every MX host, or a wildcard that covers it. max_age is how long senders cache the policy, in seconds, up to 31557600 (one year).

2. Publish the TXT record

MTA-STS TXT record
_mta-sts.example.com. TXT "v=STSv1; id=20261203T0900"

The id is any value up to 32 letters and digits. Change it every time you change the policy file; senders only fetch the file again when the id changes.

3. Add TLS-RPT, then enforce

Publish a TLS-RPT record at the same time, so senders report failures. Run testing mode for at least two weeks. When the reports show no policy failures, change mode: enforce, update the id, and keep watching the reports.

Changing MX hosts later? Add the new host to the policy and update the id before you change the MX records, or senders in enforce mode will refuse to deliver to the new host.