בס״ד

MTA-STS Checker

MTA-STS tells sending mail servers to require TLS when delivering to your domain, using a TXT record at _mta-sts.yourdomain.com plus a policy file served over HTTPS at mta-sts.yourdomain.com/.well-known/mta-sts.txt. Our checker fetches both, because a TXT record pointing at a policy file that does not load leaves the domain no better protected than having neither. TLS-RPT, published at _smtp._tls, is the companion record that asks receivers to report TLS failures to you.

$ curl https://api.dnsx.dev/email/mta-sts/example.com
$ curl https://api.dnsx.dev/email/tls-rpt/example.com

What problem does MTA-STS solve?

SMTP between mail servers uses opportunistic TLS. A sending server issues STARTTLS if the receiver offers it, and delivers in plaintext if not. It also accepts any certificate, because there was never a rule about what name the certificate should carry. An attacker on the network path can therefore strip the STARTTLS offer or present their own certificate, and the sender carries on without noticing. MTA-STS (RFC 8461, 2018) closes that gap by letting the receiving domain declare, in advance, that its MX hosts do support TLS and present certificates for their real names, so a sender that cannot get that must not deliver.

The declaration is in two parts. The TXT record at _mta-sts under the domain says a policy exists and carries an id that changes when the policy changes. The policy itself is a plain text file served over HTTPS from the host mta-sts under the domain, which is what lets it be authenticated without DNSSEC. DANE (RFC 7672) solves the same problem with TLSA records and does require DNSSEC. Google, Microsoft and most large providers honour MTA-STS when sending.

What is the difference between testing and enforce mode?

The mode line in the policy file decides what a sender does on failure. In testing mode the sender checks everything, delivers the mail regardless, and sends a TLS-RPT report describing any failure. In enforce mode the sender refuses to deliver when it cannot negotiate TLS with a certificate matching an mx pattern, and queues the message to retry. A third value, none, tells senders to drop any cached policy and is how a domain retires MTA-STS cleanly.

Start in testing with a short max_age, such as 86400, and publish TLS-RPT at the same time. After a week or two of clean reports, change mode to enforce, raise max_age to at least 1209600 (two weeks, the RFC's recommendation), and change the id in the TXT record so senders fetch the new policy. Enforce without a matching certificate on every MX host means your inbound mail from every MTA-STS-aware sender stops.

What does an MTA-STS policy file look like?

The file lives at the well-known path on the mta-sts host and is served as text/plain. It has four kinds of line, and every line uses a key, a colon and a value. Lines end in LF or CRLF, and there is no other syntax.

# https://mta-sts.example.com/.well-known/mta-sts.txt
version: STSv1
mode: enforce
mx: mail1.example.com
mx: mail2.example.com
mx: *.backup-mx.example.net
max_age: 1209600

# _mta-sts.example.com TXT
"v=STSv1; id=20260917T093000"

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

Each mx line is a hostname or a single-label wildcard, and the certificate the MX host presents must be valid for that name. Microsoft 365 domains use one line, *.mail.protection.outlook.com. Google Workspace domains list smtp.google.com or the aspmx.l.google.com hosts. The value of max_age is in seconds, with a maximum of 31557600.

What are the common MTA-STS mistakes?

  • The id never changes. Senders cache the policy for max_age and only refetch when the id in the TXT record differs from the cached one. Editing the file without changing the id leaves every sender on the old policy for up to a year.
  • The policy host does not serve TLS properly. The certificate on mta-sts.example.com must be valid for exactly that name. A wildcard for *.example.com works, and a certificate for www.example.com does not. Senders do not follow redirects, so an HTTP to HTTPS redirect or a redirect to a CDN path also fails.
  • The mx patterns do not match the real MX. A policy written when mail was self-hosted and left in place after a move to Microsoft 365 lists hosts that no longer exist. In enforce mode that blocks all inbound mail from aware senders. Our tool compares the patterns with the live MX records.
  • A wildcard is expected to cover two labels. *.example.com matches mail.example.com and does not match mx1.eu.example.com.
  • An MX host has the wrong certificate. The MX host must present a certificate for its own hostname, chained to a public CA. Self-signed certificates and expired certificates cause enforce-mode failures.
  • max_age is too short. A short cache means a sender that briefly cannot reach the policy host has no policy at all. Two weeks is the recommended minimum once in enforce mode.
  • No TLS-RPT. Without it, the only sign that enforce mode is breaking delivery is silence from a correspondent.

How do I check MTA-STS and TLS-RPT with dig and curl?

Query the two TXT records with dig and fetch the policy file with curl. Passing -i to curl shows the status line and the content type, and -v shows the certificate the policy host presented. The DNSX API runs all three checks and compares the policy against the MX records in one call.

$ dig TXT _mta-sts.example.com +short
"v=STSv1; id=20260917T093000"

$ curl -i https://mta-sts.example.com/.well-known/mta-sts.txt
HTTP/2 200
content-type: text/plain
...

$ dig TXT _smtp._tls.example.com +short
"v=TLSRPTv1; rua=mailto:[email protected]"

$ curl -s https://api.dnsx.dev/email/mta-sts/example.com | jq '.mode, .mx_match.summary'

Frequently Asked Questions

What is MTA-STS?
MTA-STS (SMTP MTA Strict Transport Security, RFC 8461) is a policy a domain publishes to tell sending mail servers that its MX hosts support TLS with a valid certificate, and that delivery must not fall back to plaintext or to an unverified certificate. It uses a TXT record at _mta-sts.yourdomain.com and a policy file at https://mta-sts.yourdomain.com/.well-known/mta-sts.txt.
What is the difference between MTA-STS testing and enforce mode?
In testing mode a sending server checks the policy and reports any failure through TLS-RPT, but delivers the mail anyway. In enforce mode it refuses to deliver when TLS cannot be negotiated or the certificate does not match an mx pattern, and retries later. Start in testing, read the TLS-RPT reports for a week or two, then switch to enforce and bump the id.
What is TLS-RPT?
TLS-RPT (SMTP TLS Reporting, RFC 8460) is a TXT record at _smtp._tls.yourdomain.com, containing v=TLSRPTv1 and a rua address, that asks sending servers to send a daily report of TLS failures they hit when delivering to your domain. It covers both MTA-STS and DANE failures. Without it, an MTA-STS policy that breaks delivery is invisible to you.
Why does my MTA-STS policy not update?
Sending servers cache the policy for max_age seconds and only fetch a new one when the id in the _mta-sts TXT record changes. If you edit mta-sts.txt without changing the id, senders keep the old policy until max_age runs out, which is often weeks. Change the id to any new string, for example the current date and time, every time the policy file changes.
Does MTA-STS need a certificate?
Yes, two of them. The policy host mta-sts.yourdomain.com must serve HTTPS with a certificate valid for that exact name, and every MX host listed in the policy must present a certificate valid for its hostname when a sender connects with STARTTLS. Both need to chain to a public CA. A self-signed certificate on the MX host causes every enforce-mode delivery to fail.
How do mx patterns in an MTA-STS policy work?
Each mx line in the policy names a host that senders may deliver to, and the certificate the host presents must match it. A leading wildcard such as *.mail.protection.outlook.com covers one label, so it matches example-com.mail.protection.outlook.com but not a.b.mail.protection.outlook.com. Every real MX host must match at least one pattern, and DNSX compares the two lists for you.

Related tools