MTA-STS and TLS-RPT: how to set them up for a client domain
Published
SPF, DKIM, and DMARC are about who is allowed to send mail as a domain. MTA-STS and TLS-RPT cover something different: whether mail sent to the domain arrives over an encrypted connection, and whether anyone hears about it when it doesn't.
Most small business domains don't publish either one. They're not hard to set up, but there's one real way to break inbound mail, so it's worth doing in the right order.
The problem MTA-STS solves
When one mail server delivers to another, it usually tries to upgrade the connection with STARTTLS. But plain SMTP treats encryption as optional. If someone in the network path strips the STARTTLS offer, or presents a certificate that doesn't match, many senders will just deliver the message unencrypted.
MTA-STS (RFC 8461) lets a domain publish a policy that says, in effect: "Only deliver to these mail servers, and only over TLS with a valid certificate." Senders that support MTA-STS fetch and cache the policy, and in enforce mode they refuse to deliver if those conditions aren't met.
TLS-RPT (RFC 8460) is the reporting side. It tells senders where to send daily summaries of TLS successes and failures when delivering to the domain.
The three pieces you publish
1. The MTA-STS TXT record
A TXT record at _mta-sts. tells senders a policy exists, and gives it an ID:
_mta-sts.client.com. TXT "v=STSv1; id=20261201T000000"The id can be any string of letters and numbers up to 32 characters. A timestamp works well. Senders use it to decide whether their cached policy is out of date, so change the id every time you change the policy file.
2. The policy file
The policy is a plain-text file served over HTTPS at a fixed location:
https://mta-sts.client.com/.well-known/mta-sts.txtA policy in testing mode looks like this:
version: STSv1
mode: testing
mx: mail1.example-provider.net
mx: mail2.example-provider.net
max_age: 86400A few rules that trip people up:
- The
mta-sts.hostname needs its own valid, publicly trusted certificate. A certificate error here means senders can't fetch the policy. - Every MX host the domain uses must match an
mx:line. A wildcard like*.example-provider.netcovers only one label to the left, so it matchesmail1.example-provider.netbut nota.mail1.example-provider.net. max_ageis in seconds, up to 31557600 (about a year). The RFC expects production values to be in the range of weeks or more.
3. The TLS-RPT TXT record
_smtp._tls.client.com. TXT "v=TLSRPTv1; rua=mailto:tlsrpt@client.com"The rua can be a mailto: address or an https: endpoint. Reports arrive as JSON, usually compressed, roughly once a day from each sender that supports TLS-RPT. Send them to a shared mailbox or a reporting service, not someone's personal inbox.
A rollout that won't break inbound mail
The risk with MTA-STS is enforcing a policy that doesn't match reality. If the policy lists the wrong MX hosts, or an MX host's certificate doesn't match its name, senders following the policy will stop delivering mail. So:
- Publish TLS-RPT first. It changes nothing about delivery, and you'll start getting data right away.
- Check every MX host. Confirm each one supports STARTTLS and presents a certificate that's valid for that exact hostname. With a major hosted mailbox provider this is normally already true, but check rather than assume.
- Publish the policy in
mode: testingwith a shortmax_age, such as one day. In testing mode, senders still deliver if there's a problem, but they report it. - Read the TLS-RPT reports for a few weeks. Look for failure types such as
certificate-host-mismatch,certificate-expired,starttls-not-supported, orsts-policy-fetch-error. - Switch to
mode: enforce, raisemax_ageto several weeks, and update theidin the TXT record. - Add it to your change process. Whenever the client changes mail providers or MX hosts, update the policy and the
idbefore the MX records change.
Common mistakes
- Forgetting to update the
id. Senders keep using their cached copy until it expires, so the change doesn't take effect when you expect. - Enforce mode with incomplete
mx:lines. In enforce mode, senders won't deliver to MX hosts that aren't listed. This is the main way MTA-STS breaks mail. - An expired certificate on
mta-sts.The policy host is easy to forget because nobody browses to it. - A TXT record with no policy file behind it, or a policy file that redirects. Senders don't follow redirects when fetching the policy.
- Removing MTA-STS abruptly. To retire it, publish
mode: nonewith a newid, wait until the oldmax_agehas passed, then remove the records.
Where DANE fits
DANE for SMTP (RFC 7672) solves the same downgrade problem using TLSA records, but it requires DNSSEC on the domain and on the MX hosts' domain. MTA-STS works without DNSSEC, which is why it's often the practical choice for small business domains on hosted email. The two can be published side by side.
How to explain it to a client
Keep it simple: "Right now, if someone interferes with the connection, other mail servers may deliver your incoming email without encryption. This setting tells them not to, and the reports tell us if anything goes wrong." It's a low-drama change that fits well into a broader email security project alongside DMARC.
FAQ
- Does MTA-STS protect the email I send?
- No. It protects mail delivered to your domain, and only from senders that support MTA-STS. Your outbound mail is protected by the recipient domain's policy, if they have one.
- Do I need a web server for MTA-STS?
- You need somewhere to serve one small text file over HTTPS at
mta-sts.on your domain, with a valid certificate. Any static hosting that supports a custom hostname and HTTPS works. - How long should a domain stay in testing mode?
- Long enough to see clean TLS-RPT reports from the senders that matter. A few weeks is a common choice. There's no fixed rule in the RFC.
- What happens if the policy file can't be fetched?
- A sender that already has a cached policy keeps using it until
max_ageruns out. A sender with no cached policy delivers as if MTA-STS weren't there. That's why a certificate error onmta-sts.causes quiet problems rather than an immediate outage.
Check a domain
A full free scan from the Client Posture homepage reads the _mta-sts record and policy file, grades the policy by mode and MX coverage, and looks up the TLS-RPT record, alongside SPF, DKIM, and DMARC.