MailSpecto
Cybersecurity 3 min read

MTA-STS and TLS-RPT – how to enforce encryption for incoming mail

Encryption between mail servers (STARTTLS) is opportunistic by default: if anything goes wrong, mail flows in plain text. MTA-STS lets you require encryption and a valid certificate, and TLS-RPT reports problems. We show how to roll out both.

MailSpecto Engineering Team

Mail infrastructure and deliverability

Sending server fetches the policy MTA-STS mode: enforce TLS + certificate matches MX Delivered encrypted only

1. The problem: STARTTLS can be silently stripped

Mail servers encrypt connections with the STARTTLS command, but they do it opportunistically:

  • if the receiving server does not advertise STARTTLS, the sender delivers the mail unencrypted;
  • the receiving server's certificate is usually not checked, so any certificate will do.

An attacker who can interfere with network traffic removes the STARTTLS announcement from the server's reply (downgrade) or puts up their own server with a fake certificate. The sender has no way of noticing.

2. How MTA-STS works

MTA-STS (RFC 8461) lets the domain owner announce: "my mail arrives only over TLS, to these MX servers, with a valid certificate". It has two parts:

A TXT record signalling that a policy exists (and its version):

_mta-sts.company.com. IN TXT "v=STSv1; id=20261126"

A policy file available over HTTPS at a fixed address, https://mta-sts.company.com/.well-known/mta-sts.txt:

version: STSv1
mode: enforce
mx: mx1.company.com
mx: mx2.company.com
max_age: 604800

A sending server that supports MTA-STS fetches the policy, caches it for max_age and from then on delivers mail only to the listed MX servers, over TLS, with a certificate matching the server name.

ModeBehaviour
nonePolicy disabled (used when withdrawing it)
testingSenders deliver mail as usual but report problems via TLS-RPT
enforceSenders will not deliver mail if TLS or the certificate does not match

3. TLS-RPT: reports on encryption problems

TLS-RPT (RFC 8460) is a record telling senders where to send daily reports about failed TLS connections:

_smtp._tls.company.com. IN TXT "v=TLSRPTv1; rua=mailto:[email protected]"

The reports show, for example, an expiring or mismatched certificate before mail starts getting lost. Without TLS-RPT, an MTA-STS rollout is done blind.

4. Rolling it out step by step

  1. Check your MX servers: each must support STARTTLS and have a valid certificate (e.g. Let's Encrypt) issued for the name in the MX record.
  2. Enable TLS-RPT to get reports from the start.
  3. Publish the policy in testing mode and the _mta-sts record.
  4. Read the TLS-RPT reports for 2–4 weeks and fix the reported problems.
  5. Switch the policy to enforce and change the id in the TXT record so senders fetch the new version.
  6. Every change of MX servers requires updating the policy file and the id; otherwise senders will reject the new server.

Hosted mail

If your mail is handled by an external service (e.g. Microsoft 365 or Google Workspace), check its documentation: the MX names in the policy file must match the provider's certificates. You host the policy file yourself, under the mta-sts subdomain of your domain.

5. MTA-STS and DANE

The alternative is DANE (TLSA records), which pins the certificate in DNS. It requires DNSSEC for the domain and the MX servers, so it is less common. Both mechanisms can be used at the same time.

6. Checking with MailSpecto

The domain audit in the panel checks whether the MTA-STS and TLS-RPT records are published. The mail server analysis for domains verified with a TXT record also fetches the MTA-STS policy file, compares it with the MX records and checks STARTTLS, the TLS version, the certificate and the DANE records of each server.

  1. Every MX server supports STARTTLS with a valid certificate.
  2. Publish TLS-RPT with a report address.
  3. Start with mode: testing, then move to enforce after reviewing reports.
  4. On every MX change, update the policy file and the id in the TXT record.

Keep your contact list clean

Verify email addresses before you send, and explore our upcoming SPF/DKIM/DMARC diagnostics module.

Try MailSpecto

MailSpecto Engineering Team

We build tools for email address verification, deliverability monitoring and mail infrastructure security diagnostics for companies in Poland and Europe.

Related articles

Cybersecurity

Open relay – how to check that your mail server is not open

What an open relay is, how to test your own server safely and how to configure it so it does not relay other people's mail.

Read article →
Cybersecurity

What is backscatter spam and how to protect your mail server

How to avoid sending false bounce messages (NDRs) from your server, and what to do when you are the victim of backscatter.

Read article →
Compliance

Article 24 of the Polish anti-abuse act – what public bodies must do about email

Who Article 24 of the Polish UZNKE covers, what it requires from public bodies and email providers, the new definition of a public entity from 3 April 2026, inspections by the UKE President, penalties and a checklist.

Read article →