MTA-STS and TLS-RPT builder
MTA-STS tells other mail servers to send mail to your domain only over TLS, to your own MX hosts. It takes a TXT record and a policy file on a web server. Build them here, with the TLS-RPT record that asks for reports, or paste one to read it.
Build the records
1. TXT record at _mta-sts.example.com
2. Policy file, served as plain text at https://mta-sts.example.com/.well-known/mta-sts.txt
3. TXT record at _smtp._tls.example.com
The policy file needs a web server for mta-sts.example.com with a certificate that is valid for that name. Senders fetch the file over HTTPS and accept only a 200 answer: they do not follow redirects.
Check the MX hosts and the records. PowerShell:
Linux or macOS:
To check the policy file, open its address in a browser: it should show the lines of the policy as plain text.
Read a record or a policy
| Part | What it says |
|---|
How MTA-STS works
A sender that supports MTA-STS looks up the TXT record _mta-sts at the domain it is sending to. When the record is there, it fetches the policy from https://mta-sts.domain/.well-known/mta-sts.txt and keeps it for up to max_age seconds. While it has the policy, it checks each MX host against the mx lines and checks that the host offers TLS with a certificate valid for its name. The mode says what happens when a check fails:
| Mode | What senders do |
|---|---|
enforce | Senders deliver only to MX hosts that match an mx line, over TLS, with a certificate that is valid for the host. When none of the MX hosts passes, they keep the message and try again later. |
testing | Senders that check a policy and find a problem send a TLS report about it, if the domain asks for reports, and deliver the message anyway. |
none | Senders treat the domain as having no policy. This is the way out: see Removing MTA-STS below. |
An mx line is a host name, or *. and a domain. The wildcard stands for exactly one label: *.example.com matches mail.example.com, but not example.com or foo.bar.example.com. An international name goes in an mx line in its xn-- form.
The TXT record has to be the only one at its name that begins with v=STSv1;, and the id is letters and digits, up to 32: senders that find none or two act as though the domain had no policy. When a sender finds the record but cannot fetch the policy, and has none cached, it delivers as though the domain had no MTA-STS. The lines of the policy may end in CRLF or LF, and senders ignore lines they do not know. RFC 8461 suggests a limit of 64 kilobytes for the file.
Changing the policy
Senders fetch the policy again when the id in the TXT record changes. So change the policy file first, then the id: a sender that sees the new id while the old file is still served caches the old policy again. Until the TTL of the TXT record has passed, some senders still use the old policy, so it should keep working for that time.
Removing MTA-STS
- Publish a policy with
mode: noneand a short max_age, such as one day. - Change the id in the TXT record, so that senders fetch it.
- Wait until every policy served before has expired: the time it was last served plus its max_age. Then remove the TXT record and the policy file.
TLS reports
The TXT record _smtp._tls asks senders for SMTP TLS reports: v=TLSRPTv1; and then rua= with one or more mailto: or https: addresses, separated by commas. A report covers one UTC day; it is a JSON file, which senders should compress with gzip, sent by email or with an HTTPS POST. Commas, exclamation marks and semicolons inside an address must be percent-encoded. In testing mode, the reports are how you find out what enforce mode would have stopped.
Sources
- MTA-STS: RFC 8461 (sections 3 to 5, 8.1 and 8.3). TLS-RPT: RFC 8460 (sections 3 and 4).
- The commands: Microsoft's reference for Resolve-DnsName (windows-powershell-docs at commit 8fc3941), used under the Creative Commons Attribution 4.0 International licence (creativecommons.org/
licenses/ by/ 4.0/), and the dig manual of BIND 9.20.31.
More Email and M365 tools
-
SMTP status code lookup
Read a bounce such as 550 5.7.1 or 421 4.4.2: the reply code and the enhanced code by class, subject and detail.
-
Email header analyzer
Paste message headers: each hop and its delay, SPF, DKIM and DMARC results, and Microsoft 365's SCL, BCL and SFV in words.
-
AADSTS error code lookup
Look up AADSTS50126, AADSTS700016 or any other Microsoft Entra sign-in error, alone or in a pasted message.
-
JWT and access token decoder
Read the claims of a Microsoft Entra access or ID token, with exp, iat and nbf as dates, in your browser.
-
dsregcmd /status reader
Paste the output of dsregcmd /status: the join state, each field in words, and the values that point at a problem.
-
Intune and Autopilot error codes
App install codes such as 0x87D1041C, MDM enrollment errors such as 0x8018000A, and Autopilot import errors 806 and 808.
-
Safe Links and URL Defense decoder
See the address inside a Microsoft Safe Links or Proofpoint URL Defense link as plain text, without opening it.
-
Punycode and lookalike checker
Convert xn-- names to Unicode and back, and see when a name mixes scripts or has letters that look like ASCII ones.
-
SPF and DMARC record builder
Build SPF and DMARC records, or paste one to see what each part does.
-
DKIM record checker
Check a DKIM key record: key type and length, flags and mistakes, with a long key split into 255-character strings.
-
DMARC report viewer
Open DMARC aggregate reports (.xml, .gz or .zip) in your browser: senders, counts, and SPF and DKIM alignment.