MTA-STS (RFC 8461) is a policy you publish that tells other mail servers "only deliver email to my domain over an encrypted, properly certificated connection, and only to these MX servers". TLS-RPT (RFC 8460) is its companion: a reporting address where those servers tell you when encrypted delivery failed. Together they close a real gap in how email is transported, and both are free to set up.
The problem: opportunistic TLS can be downgraded
Most email between servers is already encrypted with STARTTLS. The weakness is that it is opportunistic. The sending server connects, asks "do you support TLS?", and upgrades if the answer is yes. If the answer is no, it usually carries on and delivers in plain text, because for decades the priority was getting mail through.
That creates two openings for an attacker positioned between the sending server and yours, such as on a compromised network or through a tampered DNS response:
- STARTTLS stripping. The attacker removes the STARTTLS offer from your server's reply. The sender thinks you do not support encryption and delivers in clear text, which the attacker can read.
- MX spoofing. The attacker forges the DNS answer for your MX record and points the sender at their own server. Senders rarely validate certificates on server-to-server mail, so nothing stops it.
MTA-STS fixes both. A sender that supports it fetches your policy over HTTPS (which an attacker cannot easily forge), caches it, and from then on refuses to deliver unless the connection uses TLS, the certificate is valid and the MX hostname is on your list. Gmail and Microsoft's services both honour MTA-STS policies when delivering.
The three parts
| Part | Where it lives | Purpose |
|---|---|---|
| MTA-STS TXT record | _mta-sts.example.co.uk | Announces you have a policy and its current version |
| Policy file | https://mta-sts.example.co.uk/.well-known/mta-sts.txt | The actual rules: mode, allowed MX hosts, cache time |
| TLS-RPT TXT record | _smtp._tls.example.co.uk | Where to send daily reports on TLS successes and failures |
The _mta-sts TXT record
_mta-sts.example.co.uk. TXT "v=STSv1; id=20261027T090000;"
v=STSv1 is fixed. id is any string of up to 32 letters and numbers that you change every time you change the policy file. Senders cache your policy; when they see a new id, they fetch the policy again. A timestamp makes a handy id because it is obviously newer each time.
id is the most common MTA-STS mistake. Senders keep using their cached copy of the old policy until it expires, which with a long max_age could be weeks.The policy file
The policy is a plain text file served at exactly this location:
https://mta-sts.example.co.uk/.well-known/mta-sts.txt
Its contents look like this:
version: STSv1 mode: testing mx: mail.example.co.uk mx: backup-mx.example.co.uk max_age: 86400
version: alwaysSTSv1.mode:testing,enforceornone(explained below).mx: one line per MX host that is allowed to receive your mail. Wildcards are allowed for the leftmost label only, so*.mail.protection.outlook.commatchesexample-co-uk.mail.protection.outlook.com.max_age: how long senders may cache the policy, in seconds. Start with a day (86400); once stable in enforce mode, raise it to a week or more (the maximum is 31557600, about a year).
For Microsoft 365 the mx line is typically *.mail.protection.outlook.com. For Google Workspace, list the MX hostnames exactly as they appear in your DNS. Whatever you use, every hostname in your MX records must be covered, or senders in enforce mode will refuse to deliver to it.
Hosting requirements
- The
mta-stssubdomain needs an A (or CNAME) record pointing at a web server. - It must be served over HTTPS with a valid, trusted certificate for
mta-sts.example.co.uk. A free Let's Encrypt certificate is fine. - The file should be served as
text/plain, with a 200 response and no redirects. - Your MX servers themselves must present valid certificates matching their hostnames. If you use Google or Microsoft this is already true; if you run your own mail server, check it.
Testing, enforce and none
| Mode | What senders do | When to use it |
|---|---|---|
testing | Deliver as normal even if checks fail, but report failures via TLS-RPT | First few weeks, and after any mail server change |
enforce | Refuse to deliver if TLS fails, the certificate is invalid or the MX is not listed | Once reports show no unexpected failures |
none | Treat the domain as having no policy | Cleanly retiring MTA-STS (publish this, update the id, wait for caches to expire, then remove) |
TLS-RPT: reports on delivery failures
TLS-RPT is one TXT record:
_smtp._tls.example.co.uk. TXT "v=TLSRPTv1; rua=mailto:tls-reports@example.co.uk"
Supporting senders, including Google, then send a daily report (a gzipped JSON file attached to an email) summarising how many connections to your domain succeeded with TLS, how many failed, and why. Typical failure types include:
certificate-expiredorcertificate-host-mismatch: a problem with your mail server's certificate.starttls-not-supported: your server did not offer encryption, or something on the path removed the offer.sts-policy-fetch-errororsts-policy-invalid: the policy file could not be fetched or parsed.validation-failure: for example, an MX not listed in your policy.
The JSON is readable but not friendly at volume. Use a dedicated mailbox for reports, and consider a reporting service if you receive mail from many sources. You can also send reports to an HTTPS endpoint with rua=https://..., or list both separated by a comma.
Rollout steps
- Check your MX servers support TLS with valid certificates. Google Workspace and Microsoft 365 already do. For your own server, confirm the certificate covers the MX hostname and auto-renews.
- Publish TLS-RPT first. Add the
_smtp._tlsrecord and let reports arrive for a few days. They are useful even without MTA-STS. - Host the policy file in testing mode at
https://mta-sts.example.co.uk/.well-known/mta-sts.txt, listing every MX host, withmax_age: 86400. - Publish the
_mta-stsTXT record with a freshid. - Watch reports for two to four weeks. Investigate any failures, especially certificate and MX mismatches.
- Switch to enforce. Change
mode: enforce, update theidin the TXT record, and keepmax_ageshort for now. - Raise max_age to a week or longer once you are confident.
- Add it to your change process. Before changing email provider or MX records, drop back to testing mode, update the
id, and wait at least onemax_ageperiod before the switch.
mta-sts subdomain expire. Calendar both.How it fits with SPF, DKIM and DMARC
SPF, DKIM and DMARC prove that mail claiming to be from your domain really is, which protects your outbound reputation. MTA-STS and TLS-RPT protect the confidentiality of mail coming in. They are independent, and a well-run domain has all of them. If you use Google or Microsoft for email, see our Google Workspace and Microsoft 365 guides for provider-specific settings.
There is also an alternative called DANE, which pins certificates through DNSSEC instead of an HTTPS policy. It is strong but needs DNSSEC on your domain and support from senders, so MTA-STS is the more practical choice for most small businesses.
Frequently asked questions
What does MTA-STS do?
MTA-STS lets you publish a policy saying that mail servers delivering to your domain must use TLS encryption with a valid certificate, and only to the MX hosts you list. It stops attackers forcing delivery over an unencrypted connection.
Does MTA-STS protect the email I send?
No. MTA-STS protects mail coming in to your domain. Email you send to other domains is protected by their MTA-STS policy, if they have one.
Where does the MTA-STS policy file go?
At https://mta-sts.yourdomain/.well-known/mta-sts.txt, served over HTTPS with a valid certificate for the mta-sts subdomain. You also need a TXT record at _mta-sts.yourdomain.
Is TLS-RPT required for MTA-STS?
It is not technically required, but you should always set it up. Without TLS-RPT you have no visibility of delivery failures, which makes moving to enforce mode risky.
Can MTA-STS stop me receiving email?
In enforce mode, yes, if your policy lists the wrong MX hosts or your mail server certificate is invalid or expires. That is why you start in testing mode and watch TLS-RPT reports first.