Skip to main contentSkip to footer

MTA-STS Generator: Policy File and TLS-RPT Record

Read the mail servers of your domain from MX, get the MTA-STS policy file, the _mta-sts record and the TLS reporting record in one pass, and see what your domain publishes today. Free, no sign-up.

The record is built in your browser and nothing you type below is sent anywhere. Only "Load published record" and "Check" ask our server, which reads public DNS for the domain.

Mode

A wildcard like *.example.com covers exactly one label: mx1.example.com, but not mx1.eu.example.com.

What is MTA-STS?

MTA-STS (Mail Transfer Agent Strict Transport Security, RFC 8461) tells sending mail servers that your domain only accepts mail over an encrypted connection with a valid certificate, and to which mail servers. Without it, encryption between mail servers is optional: an attacker on the path can remove the offer of TLS and read the mail in plain text, and the sender would not notice.

MTA-STS consists of a policy file on a web server and a TXT record that announces it. TLS-RPT (RFC 8460) adds a report address where senders tell you when they could not deliver securely. The generator writes all three.

Set up MTA-STS in four steps

1. Load your mail servers. Enter the domain and press “Load published record”. The generator reads the MX records and enters them as mx lines of the policy. Hosts of the same provider can be combined with a wildcard such as *.mail.protection.outlook.com.

2. Publish the policy file. It goes to https://mta-sts.example.com/.well-known/mta-sts.txt, served as plain text over HTTPS with a certificate valid for mta-sts.example.com. The subdomain needs an A or CNAME record to any web server that can host the file.

3. Publish the two TXT records. _mta-sts with v=STSv1; id=... announces the policy; _smtp._tls with v=TLSRPTv1; rua=mailto:... names the address for daily TLS reports.

4. Start in testing, then enforce. In testing mode senders report problems but still deliver. After two weeks of clean TLS reports, switch the file to mode: enforce and change the id in the TXT record so senders fetch the new version.

The policy file line by line

Line Meaning
version: STSv1 Always this value.
mode: testing testing reports only, enforce refuses insecure delivery, none withdraws a policy.
mx: mx1.example.com One line per mail server that may receive mail. A wildcard covers exactly one label.
max_age: 604800 Seconds a sender may cache the policy. At most 31557600, one year.

Lines are separated by CRLF, which is how the downloaded file is written. The id in the TXT record is a free string up to 32 characters; the generator uses the current timestamp, so every new policy gets a new id automatically. Senders only fetch the file again when the id changes or max_age has expired.

The mistakes that cost mail

  • An MX server missing from the policy. Under enforce, senders refuse to deliver to it. That is the most dangerous mistake and the reason the generator starts from the live MX records instead of a blank field.
  • A wildcard read as a suffix. *.example.com matches mx1.example.com but not mx1.eu.example.com.
  • A policy that cannot be fetched. A TXT record announcing a policy whose file returns 404, redirects to another host or has an invalid certificate gives no protection at all. The check fetches the file exactly as a sender would.
  • Changing the file without changing the id. Senders keep the cached copy until max_age runs out.
  • Switching to enforce without TLS reports. Without TLS-RPT you learn about failing deliveries from users who are missing mail.

How many domains use MTA-STS

Of the 1,000 highest-ranked .de domains in the Tranco list (list 467YX, read on 19 October 2026), 924 receive mail. Only 63 publish an MTA-STS record and 62 a TLS-RPT record. More than nine out of ten German domains with a mail server therefore still accept a downgrade to unencrypted delivery without anyone noticing. MTA-STS is one of the few mail protections that costs one small file and two DNS records.

Policy examples for common mail providers

The mx lines have to match the host names in your MX records. For hosted mail the provider’s names are stable, so a wildcard keeps the policy valid when a host is added.

Mail hosted at mx lines in the policy
Microsoft 365 mx: *.mail.protection.outlook.com
Google Workspace mx: smtp.google.com for the current setup, or mx: aspmx.l.google.com plus mx: *.aspmx.l.google.com for the classic one
Your own server exactly the names in your MX records, e.g. mx1.example.com

Check the result against your real MX records before you switch to enforce. “Load published record” fills the field from MX, and once a policy is published, the check reports every MX host the policy does not cover. Remember that a wildcard covers one label only: *.aspmx.l.google.com matches alt1.aspmx.l.google.com, but not aspmx.l.google.com itself, which is why that host needs its own line.

Where to host the policy file

The file needs nothing but HTTPS with a valid certificate for mta-sts. plus your domain. Common ways to provide that:

  • The existing web server. Add the subdomain mta-sts as a virtual host or alias, request a certificate for it (Let’s Encrypt covers it), and place the file under /.well-known/mta-sts.txt.
  • Static hosting. Any static host that serves a custom domain over HTTPS works; point mta-sts to it with a CNAME.
  • A CDN rule. Some CDNs can answer a single path with a fixed text response, which avoids a server entirely.

Whatever you use, the file must be served with status 200, directly from mta-sts. plus your domain, without a redirect to another host. Senders follow no redirects, and a redirected policy counts as missing.

Frequently asked questions about MTA-STS

Do I need a web server for MTA-STS?

Yes, but a minimal one. Senders fetch a small text file over HTTPS from mta-sts.yourdomain. Any web host or static hosting service with a valid certificate for that name will do; the file never changes unless your mail servers do.

What is the difference between testing and enforce?

In testing, senders check the policy and report failures through TLS-RPT but still deliver. In enforce, they refuse to deliver over a connection without valid TLS to a listed mail server. Start with testing and switch after the reports are clean.

Does MTA-STS replace DANE?

They solve the same problem in two ways. DANE needs DNSSEC and is used by many European providers; MTA-STS works without DNSSEC and is supported by Gmail and Microsoft. Publishing both is common and does no harm.

What do TLS-RPT reports contain?

One JSON report per sender and day: how many connections were made, how many succeeded with valid TLS and the reason for each failure, such as an expired certificate or a host missing from the policy. They contain no message content.

How do I withdraw an MTA-STS policy?

Change the file to mode: none, give the TXT record a new id and keep both online at least for the max_age you published before. Deleting the records right away leaves senders enforcing the cached policy until it expires.

Is my input stored?

No. Policy and records are built in the browser. “Load published record” reads MX, _mta-sts and _smtp._tls of the domain and fetches the published policy file, like any sender would. Nothing of it is stored.

How this tool works and its limits

“Load published record” asks our resolver for the MX records, the TXT records at _mta-sts and _smtp._tls, and fetches the policy file from https://mta-sts. plus your domain. The validator of the Email Security Check then compares every mx line of a published policy with the real MX hosts, so a server the policy does not cover is reported before enforce would block it.

The generator itself works in the browser: it writes the policy from the mode, servers and cache time you choose, uses a timestamp as id and builds the TLS-RPT record from your report address. It cannot set up the web server or the certificate for the mta-sts subdomain, and it does not test whether your mail servers present valid certificates; the TLS reports will.