Skip to content

MTA-STS policy generator

Free, no sign-up Runs in your browser

Generate an MTA-STS policy file and the _mta-sts TXT record for your mail domain, per RFC 8461. Shows where each one goes and how to go from testing to enforce.

The domain after the @ in your addresses.

Mode

Start with testing: senders report failures (with TLS-RPT) but still deliver. Switch to enforce when the reports are clean.

The host names in your MX records, one per line. Each must present a valid certificate for its name.

How long a sender keeps the policy before fetching it again.

Any 1 to 32 letters and digits. Change it every time the policy file changes, so senders fetch the new one.

1. The policy file

mta-sts.txt
List your mail servers to see the policy.
Serve it over HTTPS at exactly this address
https://mta-sts.example.com/.well-known/mta-sts.txt

The mta-sts host needs a valid certificate, must answer with status 200 and no redirect, and should send the file as text/plain.

2. The DNS record

Type
TXT
Name (host)
_mta-sts.example.com
Value
List your mail servers to see the policy.

Publish the file first, then the record. Senders look for the record, and fetch the file only when its id has changed.

Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.

How to use the MTA-STS policy generator

  1. Enter your mail domain and list the host names from your MX records.
  2. Keep the mode on testing for the first weeks.
  3. Publish the policy file at the address shown, on a host named mta-sts with a valid certificate.
  4. Publish the TXT record, and create a new id whenever the file changes.

About this tool

Mail between servers is encrypted with STARTTLS only if both sides offer it, and a sender cannot tell an honest server without TLS from an attacker who stripped the offer or redirected the connection. MTA-STS closes that gap: a domain publishes a policy saying its mail servers always support TLS with a valid certificate, and which host names they have.

It has two parts. A TXT record at _mta-sts.yourdomain announces that a policy exists and carries an id. The policy itself is a small text file served over HTTPS at https://mta-sts.yourdomain/.well-known/mta-sts.txt, with a version, a mode, the allowed mx hosts and a max_age. Senders fetch the file when they see a new id and cache it for max_age seconds.

Roll it out in testing mode first, together with a TLS-RPT record so senders report failures without holding back mail. Move to enforce when the reports are clean. The mistakes that cause lost mail are an mx list that does not match the real MX records, a certificate that does not cover the mail host, and changing the file without changing the id.

Sources

Questions

What is MTA-STS?

SMTP MTA Strict Transport Security, defined in RFC 8461. It lets a mail domain tell sending servers to deliver only over TLS to servers with a valid certificate and a listed name, which prevents downgrade and redirection attacks on mail in transit.

Where does the mta-sts.txt file go?

At https://mta-sts.yourdomain/.well-known/mta-sts.txt. The host name mta-sts is fixed by the standard. It must serve the file over HTTPS with a valid certificate for that name, with status 200 and no redirect.

What is the id in the _mta-sts TXT record?

A label of up to 32 letters and digits that identifies the current version of the policy. Senders compare it with the one they cached and fetch the file again only when it differs, so you must change it every time you edit the policy.

What is the difference between testing and enforce mode?

In testing mode a sender that cannot make a valid TLS connection delivers anyway and reports the failure if you have TLS-RPT. In enforce mode it does not deliver to a server that fails the check. Start with testing so a mistake costs a report, not mail.

Related tools