MTA-STS generator

Short answer

How do I set up MTA-STS?

MTA-STS is set up with two parts: a TXT record on _mta-sts.domain with the value v=STSv1; id=20261110, and a policy file at https://mta-sts.domain/.well-known/mta-sts.txt that lists the mail servers from MX. Start with mode: testing, read the TLS reports, and move to mode: enforce when they show no errors.

Enter the domain, choose the mode and fetch the mail servers from MX.

How to set it up

  • Add the TXT record on _mta-sts in front of the domain.
  • Put the policy file on https://mta-sts.domain/.well-known/mta-sts.txt with a valid certificate.
  • Start with testing, and move to enforce when the TLS reports are clean.

Without your own web server

Micronet DMARC can host the policy file for you, so you only need two DNS records.

Example policy file

  • version: STSv1
  • mode: testing
  • mx: company-com.mail.protection.outlook.com
  • max_age: 604800

The file must be plain text (text/plain) and have one mx line per mail server. *.mail.protection.outlook.com is allowed and covers all servers under that name.

Common mistakes

  • The certificate on mta-sts.domain is invalid or covers another name.
  • The policy file is behind a redirect. RFC 8461 says senders must not follow it.
  • An mx line does not match the MX records in DNS.
  • id was not changed after the policy file was changed.

Questions and answers

What is id?

A value that must change every time the policy file changes, so senders fetch it again. We use the date and time.

Which max_age should I choose?

One week (604800) while you test, and one year (31557600) when you move to enforce. One year is the highest RFC 8461 allows.

How do I turn off MTA-STS?

Set mode: none in the policy file and change id in the TXT record. Leave both in place until the old max_age has passed, and only then remove them.

Do I need my own web server?

You need an https address on mta-sts.domain that serves the file. It can be a small static site or a service that hosts it for you.