1. DNS record
Type TXT, host
2. Policy file
Serve at
3. Publish and verify
- Create the host
mta-stsin your DNS and point it at a web host that can serve HTTPS with a valid certificate for that name. - Upload the policy file to
/.well-known/mta-sts.txt. It must be reachable without redirects and served astext/plain. - Publish the TXT record above, and a TLS-RPT record from the TLS-RPT generator.
- Run the MTA-STS checker. It fetches the file, parses it and confirms every MX host is covered.
What MTA-STS protects against
SMTP between mail servers uses opportunistic TLS: if encryption fails or an attacker strips the STARTTLS offer, mail is delivered in plain text. MTA-STS (RFC 8461) lets your domain publish a policy saying "my MX hosts always support TLS with a valid certificate". Senders that support it, including Gmail and Microsoft 365, then refuse to deliver over an insecure connection or to a server whose certificate does not match one of the listed MX names.
Testing first, then enforce
In testing mode senders deliver as usual but report TLS failures to your TLS-RPT address. Watch those reports for one to two weeks. If they show no failures for legitimate MX hosts, switch the policy file to enforce, update the id in the TXT record, and keep the reports coming. To retire MTA-STS, publish mode: none with a new id and leave it in place for at least the old max_age before removing anything.
Common mistakes
- Leaving an old provider's MX in the policy after a migration, or forgetting to add the new one. In enforce mode that blocks mail.
- Serving the file through a redirect, for example from http to https or from mta-sts.example.com to www. Senders must fetch it directly.
- Changing the file without changing the id, so senders keep the cached version.
- A certificate that covers example.com but not mta-sts.example.com.
Related tools
MTA-STS checker
Policy file and TLS-RPT
Open tool →MX lookup
Mail servers, priority, PTR
Open tool →Domain health report
Shareable, printable report
Open tool →TLS-RPT generator
TLS reporting record
Open tool →Get alerted when it changes
Free daily monitoring re-checks SPF, DKIM, DMARC, MX, BIMI and MTA-STS and emails you when something changes or fails.
Set up free monitoringFrequently asked questions
Where do I host the MTA-STS policy file?
At https://mta-sts.yourdomain/.well-known/mta-sts.txt, served as text/plain with a valid certificate for mta-sts.yourdomain and without redirects. Any static host works: a Cloudflare Worker or Pages project, GitHub Pages with a custom domain, or your existing web server.
What should max_age be?
How long senders may cache the policy, in seconds. Use 86400 (one day) while testing and 604800 (one week) or more once enforced. RFC 8461 allows up to 31557600 (about a year).
When do I change the id?
Every time you edit the policy file. Senders re-fetch the file only when the id in the TXT record changes. Any unique string of letters and numbers works; a timestamp is common.
Do I need TLS-RPT too?
It is strongly recommended. TLS-RPT reports tell you when senders fail to establish TLS with your MX hosts, which is the only way to know enforce mode is safe. Use the TLS-RPT generator.
What do wildcards in mx: lines mean?
A leading *. matches exactly one label. mx: *.mail.protection.outlook.com matches yourdomain-com.mail.protection.outlook.com but not a.b.mail.protection.outlook.com.