Guides MTA-STS

What is MTA-STS?

Protect incoming mail on its way to your mail server. Set the rules for senders and check that they work before enforcing or changing them.

Mail for example.com should reach your mail server over a secure connection. You can tell sending servers which protection you require. MTA-STS publishes those requirements. A sender that supports MTA-STS and already knows the requirements can use them to prevent unsafe delivery.

Check MTA-STS on your own domain

One delivery to example.com

Another mail server wants to deliver a message to info@example.com. It normally tries to make an encrypted connection. If that fails, it may fall back to an unencrypted connection unless an additional agreement prevents it.

To stop that unsafe delivery attempt, you publish an agreement: deliver only to the right receiving server and with the required protection. A supporting sender that has retrieved and stored this valid agreement must follow it when enforcement is enabled.

This protects the connection to your mail server. It does not check who wrote the message or what it says. An attacker can also prevent a sender from discovering the agreement for the first time. Senders that do not yet know the agreement or do not support MTA-STS are outside this protection.

A complete starting configuration

Your mail provider knows which servers receive mail for example.com. The public domain settings are called DNS. They list the server names in MX records. The connection encryption is called TLS. Mail servers use STARTTLS to agree to use that protection. The receiving server must also use a valid certificate to show that it is the expected server.

Start by checking and reporting without blocking delivery because of MTA-STS. The example uses this testing mode.

First ask your mail provider which MX hostnames it uses for your domain and whether it can manage MTA-STS. Your DNS administrator publishes the marker. Your web host or MTA-STS service provides the HTTPS file. For a managed service, use that service's values and instructions.

Example domain: example.com, with two receiving servers. The TXT record is: _mta-sts.example.com TXT "v=STSv1; id=2026111001". Some DNS panels append example.com automatically. Enter only _mta-sts as the name there.

At https://mta-sts.example.com/.well-known/mta-sts.txt, serve a text file with the following lines. Each must be a separate line, with no bullet characters or blank lines between them:

  • version: STSv1
  • mode: testing
  • mx: mx1.mailprovider.example
  • mx: mx2.mailprovider.example
  • max_age: 86400

Replace both example MX hosts with all your actual receiving servers, including backups. These are the hostnames in your MX records, not automatically your own domain name. max_age is the cache lifetime in seconds: 86400 is one day, used here as a rollout example. A longer lifetime is often appropriate once enforcement is stable.

The HTTPS server must return status 200 directly, without a redirect, and present a valid trusted certificate for mta-sts.example.com. Prefer Content-Type: text/plain for the file. An ordinary web page at that address is not enough.

Receiving and reading TLS-RPT reports

Senders can report problems they encounter with the secure connection. TLS-RPT lets you request these aggregate reports.

Senders need to support TLS-RPT to provide them. For example, publish: _smtp._tls.example.com TXT "v=TLSRPTv1; rua=mailto:tls@example.com". Use an address you control or the destination supplied by your reporting service. Agree who investigates failures.

These are machine-readable JSON reports, often sent by email as a compressed attachment. They include the reporting organization, reporting period, applied policy, and counts of successful and failed TLS sessions. A reporting service can turn them into a readable summary. Daily reporting is recommended, but receipt is not guaranteed.

For example, if a report shows certificate-host-mismatch for one MX, have its certificate name checked. For policy-fetch problems, check the HTTPS policy host. Session counts are not counts of delivered messages. TLS-RPT can also describe DANE or a situation where no policy was found. The reports are not limited to MTA-STS errors.

Moving from testing to enforce

testing lets senders report problems without blocking delivery because of MTA-STS. enforce makes those checks mandatory for supporting senders applying the policy. none is intended for withdrawing MTA-STS in a controlled way.

Before enabling enforce, check the following:

  • Enable TLS-RPT and assign someone to review the reports.
  • Have an administrator test every primary and backup MX for STARTTLS, a trusted certificate chain that has not expired, and a certificate name matching the MX host.
  • Check that the policy covers all those MX hosts and investigate recurring report failures.
  • Only then move to enforce. Publish the changed HTTPS file first, then change id= in DNS.

The observation period depends on your traffic and which senders report. Receiving no reports does not prove there are no failures. A rarely used backup MX therefore needs a deliberate test too.

Changing mail providers or withdrawing MTA-STS

Senders store policies. id= signals a change but does not immediately replace every cache. Senders may also refresh a policy proactively. Simply deleting the TXT record or HTTPS file is therefore not a safe emergency stop.

Plan a provider change with your administrator:

  • First publish an HTTPS policy allowing both the old and new MX hostnames.
  • Then change id=. Keep the old mail route working during the transition.
  • Plan the MX change around the DNS TTL and the lifetimes of previously served policies. For a conservative migration, wait until old, narrower policies have expired. The most recent max_age is not always the longest still held in caches.
  • Test the new route and remove old MX coverage only when it is no longer needed. For that policy change too, update HTTPS first and id= afterwards.

Want to stop? First publish a valid file with version: STSv1, mode: none and, for example, max_age: 86400, each on a separate line. Then give the TXT record a new id. Keep the file and marker available until every previously served policy has expired. Only then remove them. The waiting period follows your publication history, not a fixed interval for every domain.

What the scan tells you

A TXT marker only proves that an announcement is published. If DNS Radar has fetched the HTTPS file, it can also assess the contents and coverage of the observed MX hostnames. Without a successful fetch, that part remains unknown.

The scan does not open an SMTP connection or test STARTTLS or MX certificates. It also cannot see policies held by other senders or whether TLS-RPT reports arrive. Use a positive DNS/policy result alongside your administrator's connection tests and reports.

Sender checks answer a different question: may this domain be used as the sender? Those checks are called SPF, DKIM and DMARC. MTA-STS protects transport to your mail server, not that sender identity.

Primary sources

Frequently asked questions

How does this differ from DANE/TLSA?

Both can protect mail in transit. MTA-STS publishes its delivery agreement over a secure web connection, HTTPS. DANE puts certificate or key information in the domain settings and requires validated DNS answers, using DNSSEC. What is practical also depends on your mail and DNS providers. You can use both. See the TLSA guide for more about DANE.

Do I need a separate web server?

You need an HTTPS service that serves the file at the fixed hostname and path. It does not have to be your own server: a mail provider or specialist service may provide it. Check that the certificate is valid for your mta-sts subdomain and that no redirect is needed.

Does publishing MTA-STS also protect my outgoing mail?

Your publication describes how others should deliver to you. For outgoing mail, your sending service must support MTA-STS and apply the recipient's policy. Ask your provider about that support. Adding a record at your own domain does not enable it.

No TLS-RPT reports have arrived. Does that mean everything is fine?

You cannot conclude that. There may be little traffic, senders may not report, or report delivery may fail. Check the record and report destination, and test every MX separately before tightening enforcement.

Check MTA-STS on your own domain →