Home / Guides / Authentication

MTA-STS and TLS-RPT: secure the email sent to you

How MTA-STS stops attackers downgrading email to your domain to unencrypted delivery, and how TLS-RPT reports tell you when something goes wrong.

8 min read · Updated 27 October 2026 · By the dijitul team

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.

MTA-STS protects email sent to you. It has no effect on mail you send out, and it does not affect spam scoring. It is a security control, which is why it often appears in cyber insurance questionnaires and security audits.

The three parts

PartWhere it livesPurpose
MTA-STS TXT record_mta-sts.example.co.ukAnnounces you have a policy and its current version
Policy filehttps://mta-sts.example.co.uk/.well-known/mta-sts.txtThe actual rules: mode, allowed MX hosts, cache time
TLS-RPT TXT record_smtp._tls.example.co.ukWhere 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.

Forgetting to change the 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: always STSv1.
  • mode: testing, enforce or none (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.com matches example-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-sts subdomain 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.
Managed UK hostingdijihostManaged UK hosting with Plesk, Cloudflare DNS, daily backups and a domain included, for £1 a day + VAT. Old sites welcome.Host with dijihost

Testing, enforce and none

ModeWhat senders doWhen to use it
testingDeliver as normal even if checks fail, but report failures via TLS-RPTFirst few weeks, and after any mail server change
enforceRefuse to deliver if TLS fails, the certificate is invalid or the MX is not listedOnce reports show no unexpected failures
noneTreat the domain as having no policyCleanly retiring MTA-STS (publish this, update the id, wait for caches to expire, then remove)
Check your setup now: run a free test at mail-tester.co.uk and see your score in seconds.

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-expired or certificate-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-error or sts-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

  1. 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.
  2. Publish TLS-RPT first. Add the _smtp._tls record and let reports arrive for a few days. They are useful even without MTA-STS.
  3. Host the policy file in testing mode at https://mta-sts.example.co.uk/.well-known/mta-sts.txt, listing every MX host, with max_age: 86400.
  4. Publish the _mta-sts TXT record with a fresh id.
  5. Watch reports for two to four weeks. Investigate any failures, especially certificate and MX mismatches.
  6. Switch to enforce. Change mode: enforce, update the id in the TXT record, and keep max_age short for now.
  7. Raise max_age to a week or longer once you are confident.
  8. 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 one max_age period before the switch.
The two ways people break their inbound mail with MTA-STS: moving to a new email provider while an enforce policy still lists the old MX hosts, and letting the certificate on their own mail server or on the 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.

From the team behind Mail Tester UK

More from dijitul