How to set up MTA-STS and TLS-RPT
Last updated: October 27, 2026
SMTP encryption is opportunistic by default: two servers try STARTTLS, but if anything goes wrong they silently fall back to plaintext. An attacker in the network path can exploit this by stripping the STARTTLS advertisement, forcing your correspondents' servers to deliver mail to you unencrypted. MTA-STS (RFC 8461) lets you declare: mail to my domain must use TLS, and only to these MX hosts, with valid certificates.
The mechanism has two halves. A DNS TXT record at _mta-sts.yourdomain.com announces that a policy exists and carries an id that senders cache to detect updates. The policy itself is a plain-text file served over HTTPS at https://mta-sts.yourdomain.com/.well-known/mta-sts.txt listing your MX hosts, the mode, and max_age.
TLS-RPT (RFC 8460) is the companion: a TXT record at _smtp._tls.yourdomain.com that tells sending servers where to email reports about TLS negotiation failures. Together they give you downgrade protection plus visibility — and both are increasingly expected as baseline hygiene for serious domains.
Not sure if this affects you? Run a free domain audit and see the exact check result.
Run the free domain checkStep by step
Prerequisites
- All your MX hosts must present valid, publicly trusted TLS certificates matching their hostnames (Let's Encrypt is fine).
- You need to serve one small file over HTTPS on a new subdomain — any static hosting, CDN, or your existing web server works.
Publish the policy
- Create the policy file (see example below): version STSv1, mode: testing to start, your MX hostnames, max_age: 86400 while testing.
- Serve it at https://mta-sts.example.com/.well-known/mta-sts.txt with a valid certificate for mta-sts.example.com and content-type text/plain.
- Publish the DNS record: _mta-sts TXT "v=STSv1; id=20261027T000000" — bump the id every time the policy changes.
- Add TLS-RPT: _smtp._tls TXT "v=TLSRPTv1; rua=mailto:tls-reports@example.com" and read the JSON reports.
Move to enforce
- Watch TLS-RPT for two to four weeks in testing mode; any persistent failure (expired MX cert, hostname mismatch) must be fixed first.
- Change the policy to mode: enforce and raise max_age to 604800 or more (weeks); bump the id in the _mta-sts TXT record.
- Re-verify after MX changes: adding a provider whose hostname is not listed in the policy will block delivery in enforce mode.
Hosted shortcuts
- Google Workspace and Microsoft 365 handle their own inbound TLS posture; MTA-STS matters for domains receiving on their own MX.
- Some DNS/security providers (e.g. Cloudflare) can host the policy file for you; you still publish the two TXT records yourself.
Copy-paste examples
version: STSv1 mode: testing mx: mail.example.com mx: mx2.example.com max_age: 86400
_mta-sts TXT "v=STSv1; id=20261027T000000" _smtp._tls TXT "v=TLSRPTv1; rua=mailto:tls-reports@example.com"
version: STSv1 mode: enforce mx: mail.example.com mx: mx2.example.com max_age: 604800
Common mistakes
- Going straight to enforce — a stale MX list or an expiring certificate then blocks real inbound mail; always start in testing with TLS-RPT.
- Forgetting to bump the id in _mta-sts after editing the policy — senders cache the old policy until max_age expires.
- Policy served without a valid certificate for mta-sts.<domain> — senders refuse to fetch it; the whole mechanism silently does nothing.
- Listing the wrong MX hostnames — the policy must match the MX records exactly, including providers you added later.
- No TLS-RPT mailbox — you lose the only telemetry that tells you enforce mode is safe.
- Short max_age left in place — policies expire quickly and protection flickers off; use weeks in enforce.
FAQ
Does MTA-STS protect mail I send?
No — it protects mail sent TO your domain: sending servers check your policy before delivering to you. Outbound protection depends on the recipient's MTA-STS, which your server can honor.
Is MTA-STS required by Gmail/Yahoo bulk sender rules?
Not required, but it is an increasingly visible trust signal, and some security-conscious receivers score for it. DANE is the DNSSEC-based alternative; MTA-STS is far easier to deploy.
What happens in enforce mode if my MX certificate expires?
Senders that honor MTA-STS will defer (queue) delivery rather than fall back to plaintext — mail is delayed, not lost, but it will pile up until you renew. Monitoring with TLS-RPT gives you early warning.
Can I use MTA-STS with a hosted mail provider?
Yes if the provider supports it — your policy lists their MX hostnames. Check their docs first; if they rotate MX hosts, they usually publish guidance or manage MTA-STS themselves.
MTA-STS vs DANE — which one?
DANE requires DNSSEC end-to-end and is stronger but operationally heavier. MTA-STS needs only HTTPS and DNS TXT. Many domains deploy MTA-STS first; some do both.
Where can I host the policy file if I have no web server?
Any static HTTPS hosting works: a CDN page rule, an S3/GCS bucket behind HTTPS, GitHub Pages with a custom domain, or your DNS provider's hosting add-on. The file is ~100 bytes and fetched rarely, so cost is effectively zero. The only hard requirements are a valid certificate for mta-sts.yourdomain.com and the exact path /.well-known/mta-sts.txt. Some security-focused DNS providers offer one-click MTA-STS hosting — worth checking before building your own.
Fixed it? Prove it.
Send a test email and watch every check go green.
Send a test email to verify the fix