Guide

MTA-STS. Enforce TLS for Inbound Mail

SMTP encryption is opportunistic by default, attackers can strip it. MTA-STS lets you demand TLS for mail sent to your domain.

9 min read·Updated Jun 10, 2026
TL;DR
SMTP encryption is opportunistic: senders try TLS, and if a man-in-the-middle strips the offer, they silently fall back to plaintext. MTA-STS closes that hole. Setup is one TXT record plus a small policy file served over HTTPS at mta-sts.yourdomain.com. Start in testing mode with TLS-RPT enabled, then flip to enforce.

What is MTA-STS?

When another mail server delivers email to your domain, it connects to your MX host and asks "do you support encryption?" via the STARTTLS command. If the answer is yes, the connection upgrades to TLS. The problem: that negotiation happens in plaintext. An attacker sitting on the path can simply delete the STARTTLS offer, and the sending server, designed in an era when any delivery beat no delivery, shrugs and sends your customers' password resets and invoices unencrypted.

MTA-STS (Mail Transfer Agent Strict Transport Security, RFC 8461) is your way of saying: don't fall back. You publish a policy declaring that mail to your domain must arrive over TLS 1.2+, with a valid certificate, to a specific list of MX hosts. Compliant senders, which includes Gmail, Outlook, and Yahoo, cache that policy and refuse to deliver if the requirements can't be met.

Why it matters

  • It closes a real attack: STARTTLS stripping is trivial for anyone on-path (hostile networks, rogue Wi-Fi, compromised routers) and invisible to both sender and recipient.
  • Inbound mail often carries your most sensitive data: password resets, legal documents, customer PII. Opportunistic encryption protects none of it against an active attacker.
  • It's a maturity signal: security questionnaires and email-security scanners increasingly check for it. Gmail publishes an enforce-mode policy on gmail.com itself.

How to check it

# 1. Is the policy flag published?
dig +short txt _mta-sts.example.com

# 2. Does the policy file resolve over HTTPS?
curl https://mta-sts.example.com/.well-known/mta-sts.txt

Both must work. A TXT record with no reachable policy file is a no-op; a policy file with no TXT record is never discovered.

Setting it up, step by step

  1. Create the policy file and serve it at https://mta-sts.example.com/.well-known/mta-sts.txt with a valid certificate for mta-sts.example.com (Cloudflare Pages, GitHub Pages, or a tiny static bucket all work):
    version: STSv1
    mode: testing
    mx: mx1.example.com
    mx: mx2.example.com
    max_age: 86400
    The mx lines must match your actual MX hostnames (wildcards like *.google.com are allowed). For Google Workspace use mx: *.google.com; for Microsoft 365 use mx: *.mail.protection.outlook.com.
  2. Publish the discovery TXT record:
    _mta-sts.example.com.  TXT  "v=STSv1; id=20260610"
    The id is an opaque change marker, a datestamp is the convention. Bump it every time you edit the policy file.
  3. Publish TLS-RPT alongside it (see our TLS-RPT guide) so senders tell you when delivery fails against your policy. Don't enforce blind.
  4. Watch reports for 2–4 weeks in testing mode. Failures here cost you nothing, mail still flows, but they tell you about cert mismatches or forgotten MX hosts.
  5. Flip to mode: enforce, bump the id, and raise max_age (604800, one week, is a sensible production value).
Watch out
The certificate on your MX hosts must be valid and match the MX hostname, and the certificate on mta-sts.example.com must be valid too. An expired cert on either side under mode: enforce means compliant senders queue and eventually bounce your inbound mail. This is why you monitor before and after enforcing.

Common mistakes

  1. Forgetting to bump id after editing the policy. Senders keep using the cached old policy for up to max_age seconds.
  2. MX list drift. You migrate mail providers, update MX records, and forget the policy file. Under enforce mode, the new MX hosts aren't on the list and inbound mail stalls.
  3. Serving the policy with a redirect or wrong content type. The file must be served directly, over HTTPS, as plain text. Some senders won't follow redirects.
  4. Self-signed or mismatched certs on MX hosts. Fine under opportunistic TLS, fatal under enforce.
  5. Jumping straight to enforce without TLS-RPT. You'll have no idea what broke or for whom.

Monitoring MTA-STS going forward

MTA-STS has more moving parts than most DNS-only standards: a TXT record, an HTTPS endpoint, a certificate on that endpoint, certificates on every MX, and a policy file that must stay in sync with your actual MX records. Any one of them can rot independently.

DomainsDoc checks the whole chain continuously: the TXT record, the policy file's reachability and syntax, whether the listed MX hosts match your live MX records, and the certificates involved. The moment something drifts, you get one alert instead of a slow trickle of mysteriously delayed mail. Add your domain to start, and see pricing for plans.

Frequently asked questions

What is MTA-STS in plain English?
MTA-STS lets you publish a policy that says "mail sent to my domain must be delivered over encrypted TLS connections, to these specific mail servers." Without it, SMTP encryption is opportunistic: a sending server will happily fall back to plaintext if an attacker strips the encryption offer.
Why do I need both a DNS record and an HTTPS file?
The TXT record at _mta-sts.yourdomain.com is just a version/id flag that tells senders a policy exists and signals when it changes. The actual policy lives at https://mta-sts.yourdomain.com/.well-known/mta-sts.txt, fetched over HTTPS so it cannot be spoofed by a DNS attacker, which is exactly the attacker MTA-STS defends against.
What is the difference between mode: testing and mode: enforce?
In testing mode, senders check your policy and report failures (via TLS-RPT) but still deliver mail even if TLS fails. In enforce mode, senders refuse to deliver mail that cannot be sent over valid TLS to a listed MX. Start in testing, watch reports for a couple of weeks, then move to enforce.
Do I need to update the DNS record when I change the policy?
Yes. Senders cache your policy for max_age seconds. The id field in the TXT record is how you signal a change: bump it (a datestamp like 20260610 works well) and compliant senders will re-fetch the policy file.
Does Google Workspace or Microsoft 365 support MTA-STS?
Both honor MTA-STS policies when sending. For receiving, you publish your own policy listing their MX hosts (e.g. mx: *.google.com for Workspace, mx: *.mail.protection.outlook.com for M365). Gmail itself publishes an enforce-mode policy, which tells you how mainstream this has become.
How does MTA-STS relate to DANE?
Both solve the same problem (downgrade attacks on SMTP TLS). DANE uses DNSSEC-signed TLSA records; MTA-STS uses HTTPS and works without DNSSEC. Big providers chose MTA-STS because DNSSEC deployment is patchy. You can publish both; receivers that support DANE prefer it.
Stop reading. Start monitoring.

Continuous SPF, DKIM, DMARC, blacklist, SSL, and uptime checks. Alerts the moment something breaks.

Start free
Keep reading