Blog/ Email glossary & concepts

What Is MTA-STS? Enforced TLS for Inbound Email Explained

Nafiul HasanNafiul Hasan· 9 min read
Diagram explaining what MTA-STS is: a sending mail server checks a domain's DNS record and HTTPS policy file, then enforces validated TLS before delivering inbound email.

The short answer

MTA-STS (RFC 8461) is a standard that lets a domain tell sending mail servers it requires encrypted, certificate-validated TLS for inbound email. It closes a gap in SMTP: STARTTLS is optional and can be stripped by an attacker, so mail can silently downgrade to plaintext. MTA-STS makes that downgrade a delivery failure instead.

MTA-STS lets a domain require validated, encrypted TLS for inbound email. Here is how the DNS record, HTTPS policy file, and testing-to-enforce modes work.

On this page
  1. 01How does MTA-STS work?
  2. 02What goes in the mta-sts.txt policy file?
  3. 03Why MTA-STS matters: what breaks without it
  4. 04The three modes, and why testing comes before enforce
  5. 05MTA-STS vs DANE: what's the difference?
  6. 06Common misconceptions about MTA-STS
  7. 07Where AI Emaily fits (and where it doesn't)

So what is MTA-STS? MTA-STS — SMTP MTA Strict Transport Security — is the standard defined in RFC 8461 that lets your domain publish a rule: any server sending mail to you must use TLS, and that connection must be authenticated with a valid certificate. If a sender cannot meet the rule, it refuses to deliver rather than fall back to an unencrypted connection.

The problem it solves is specific. Server-to-server email runs on SMTP, which encrypts opportunistically through a command called STARTTLS. Opportunistic means optional: if the encrypted handshake does not happen, most servers just send the message in plaintext. An attacker positioned between two mail servers can force that by stripping the STARTTLS offer, and neither side notices the downgrade.

MTA-STS removes that silent fallback. It gives a receiving domain a way to say — in a place an attacker cannot quietly rewrite — that a downgrade is not acceptable. This guide covers the three moving parts (a DNS record, an HTTPS-hosted policy file, and the none / testing / enforce modes) plus the deployment order most vendor write-ups skip.

How does MTA-STS work?#

MTA-STS has three parts: a DNS record that advertises a policy exists, an HTTPS-served file that spells the policy out, and a caching model that tells senders how long to trust it. A sending server that supports MTA-STS runs the same sequence before delivery.

  1. 1

    Check the DNS TXT record

    The sender looks up a TXT record at _mta-sts.<your-domain>. It carries two fields, v=STSv1 and an id string. The id is a version tag: change your policy, change the id, and senders know to re-fetch.

  2. 2

    Fetch the policy over HTTPS

    If the id is new, or nothing is cached, the sender requests https://mta-sts.<your-domain>/.well-known/mta-sts.txt. It must be served over HTTPS with a certificate valid for that host and return HTTP 200. Per RFC 8461, senders must not follow a redirect to it.

  3. 3

    Validate the receiving server

    Before delivering, the sender checks that the receiving MX host matches an mx pattern in the policy and that its certificate chains to a trusted authority. STARTTLS has to be offered and succeed.

  4. 4

    Apply the mode, then cache

    The mode field decides what happens on a failure. The sender then caches the policy for up to max_age seconds, so it does not re-fetch on every message.

What goes in the mta-sts.txt policy file?#

The policy file is plain text, one key-value pair per line. Four fields carry the whole policy. Here is a complete example for a domain served by two MX hosts.

Where it livesFieldWhat it does
DNS TXT at _mta-sts.<domain>v=STSv1Protocol version. Only STSv1 is defined today.
DNS TXT at _mta-sts.<domain>id=<string>A unique policy ID. Changing it tells senders to re-fetch the file.
Policy file (HTTPS)version: STSv1Protocol version, repeated inside the file.
Policy file (HTTPS)mode: none | testing | enforceHow strictly senders apply the policy on a failure.
Policy file (HTTPS)mx: <host pattern>An allowed MX hostname, one line per pattern. Wildcards like *.example.net are allowed.
Policy file (HTTPS)max_age: <seconds>How long senders cache the policy, up to 31557600 (about a year).
An MTA-STS policy file (mta-sts.txt)
versionSTSv1
modeenforce
mxmail.example.com
mx*.example.net
max_age604800

The HTTPS layer is the part an attacker cannot forge

The policy must be served over HTTPS from exactly mta-sts.<your-domain>, with a certificate valid for that host. A plain-HTTP file, an expired certificate, or a redirect is treated as no policy at all. The DNS flag can be spoofed; a valid certificate for your policy host cannot, so the HTTPS fetch is what makes the policy trustworthy.

Why MTA-STS matters: what breaks without it#

Without MTA-STS, TLS between mail servers is opportunistic, so it is optional. If the encrypted handshake is disrupted, the message goes out in plaintext instead of failing — convenient for delivery, useless for security, because an on-path attacker can quietly turn encryption off.

The concrete attack is STARTTLS stripping. An attacker between two servers removes the STARTTLS offer, both sides fall back to plaintext, and the mail — password resets, invoices, contracts — crosses the wire in the clear. A related attack spoofs the MX record to route mail through a server the attacker controls. Enforce mode blocks both, because it requires a matching MX and a valid certificate before any message is handed over.

One limit is worth stating plainly: MTA-STS protects a sender that has already cached your policy. On the very first contact, before any policy is cached, there is a window an attacker could exploit. The protection is strong, but not first-contact-proof — DANE, below, closes that gap differently.

The three modes, and why testing comes before enforce#

The mode field is where rollouts go wrong, because the tempting move — publish enforce and be done — is the one that can silently drop legitimate mail. The three modes are a deployment path, not three equal options.

  • none — an explicit opt-out. Senders treat your domain as though it has no active policy. It mainly lets you wind a policy down cleanly.
  • testing — senders fetch and evaluate the policy but do not block on failure. If they support TLS reporting, they send you a report of what would have failed. Mail keeps flowing.
  • enforce — senders must not deliver to an MX host that fails MX matching, fails certificate validation, or does not support STARTTLS. This is the mode that actually protects you.
A decision fork for the MTA-STS rollout order: publish in testing mode to observe and collect reports, fix any MX or certificate problems, then switch to enforce mode to block failed deliveries.
Testing observes without blocking; enforce blocks. Fix problems in the first before you commit to the second.

Turn on reporting first, then start in testing

Publish a TLS-RPT record (RFC 8460) at _smtp._tls.<your-domain> with a value like v=TLSRPTv1; rua=mailto:tlsrpt@your-domain, then set your MTA-STS policy to testing. Read the aggregate reports for a few weeks to catch any MX or certificate issue that enforce would have turned into a bounce. Only when they are clean do you flip mode to enforce and change the id.

MTA-STS vs DANE: what's the difference?#

MTA-STS and DANE for SMTP (RFC 7672) solve the same problem — stopping TLS downgrade between mail servers — but rest on different trust anchors. MTA-STS uses public certificate authorities and an HTTPS-hosted policy. DANE uses DNSSEC-signed records and needs no public CA.

DimensionMTA-STS (RFC 8461)DANE for SMTP (RFC 7672)
Trust anchorPublic CA certificate plus an HTTPS-hosted policyA DNSSEC-signed TLSA record; no public CA required
Requires DNSSEC?NoYes — DNSSEC is mandatory
How the policy is foundDNS TXT flag, then an HTTPS policy fileA TLSA record at _25._tcp.<mx-host>, validated by DNSSEC
First-contact protectionNo — needs a previously cached policyYes — validated on every connection
Report-only / testing modeYes — testing modeNo built-in testing mode
Certificate typeMust chain to a trusted root CASelf-signed allowed if it matches the TLSA record

Neither standard obsoletes the other, and some domains publish both. DANE needs DNSSEC, which many domains and registrars still do not deploy; MTA-STS works with the public CA system every domain already uses, which is why large mailbox providers adopted it widely. If you already run DNSSEC, running both adds first-contact protection on top of a familiar policy.

Common misconceptions about MTA-STS#

MTA-STS sits next to several other email standards, and the overlap breeds confusion.

  • It does not encrypt your email end to end. It secures the server-to-server hop, and only on mail arriving at a domain that publishes a policy. The message is still readable on each server it passes through, unlike PGP or S/MIME.
  • It does not replace SPF, DKIM, or DMARC. Those authenticate who sent a message; MTA-STS secures how the message travels. Different jobs — you want both.
  • Enforce is not the safe way to start. Publishing enforce before testing can silently block real mail from a misconfigured MX or a certificate problem. Start in testing.
  • It is not set-and-forget. A lapsed certificate on mta-sts.<your-domain>, or an MX change you forget to reflect, can make senders refuse your inbound mail. TLS-RPT is what catches that.
  • Sending and receiving are two sides. As a sender, your provider applies recipients' policies for you. As a domain owner, your policy only protects mail others send to you.

A broken policy can block your own inbound mail

In enforce mode, an expired mta-sts.<domain> certificate or an MX host missing from the policy makes compliant senders refuse delivery. Microsoft's Exchange Online, for example, returns a 5.4.8 NDR when the MX fails policy validation and 5.7.5 when the certificate fails. To pause enforcement fast, switch the policy to testing and update the id.

Where AI Emaily fits (and where it doesn't)#

MTA-STS is a control you set at the DNS and web-hosting layer, and it protects mail in transit between servers before it reaches a mailbox. AI Emaily is not part of that layer. It does not publish MTA-STS policies, act as a mail server, or host your policy file — that job belongs to your DNS provider and web host, and no email client can do it for you.

What AI Emaily does starts once a message has landed. It is an AI-native email client for Gmail, Outlook, and IMAP that triages the inbox, drafts replies you approve before they send, and defends against spam and phishing that get through. Mail you send rides your provider's outbound path — and as of August 2026 both Gmail and Exchange Online already apply recipients' MTA-STS policies for you. Sensitive data it stores, such as OAuth tokens and message bodies, is encrypted. So MTA-STS hardens the pipe; AI Emaily handles what comes out of it. We build AI Emaily.

Frequently asked

Nafiul Hasan

Written by

Nafiul Hasan

Nafiul Hasan is an entrepreneur and AI automation system builder with 10+ years of experience turning messy, manual workflows into reliable automated systems. He designs and ships AI enterprise solutions end-to-end — the agent logic, the data plumbing, and the product people actually use — and founded AI Emaily to give busy professionals their attention back. He writes here from the builder's seat: what works, what breaks, and how to put AI to work without giving up control.

EntrepreneurAI Automation System BuilderAI EnthusiastBuilds AI Enterprise Solutions10+ years experience
More from Nafiul
Ready when you are

Secure the pipe, then let AI Emaily handle what lands.

MTA-STS hardens mail in transit at the DNS and server level. AI Emaily is the AI-native client that triages, drafts, and defends the inbox once mail arrives — across Gmail, Outlook, and IMAP, with approve-before-send and a full audit trail. Start a 7-day free trial.

  • 7-day free trial
  • Cancel anytime
  • Every provider