---
title: What Is MTA-STS? Records, Policy File and Modes Explained
description: MTA-STS tells sending mail servers to use verified TLS when delivering to your domain. See the TXT record, policy file, modes and TLS-RPT setup.
canonical: https://sendhq.cc/blog/mta-sts
last-updated: 2026-11-13
author: Dhrumil Barot
author_bio: Dhrumil is an email marketing expert. Dhrumil built SendHQ so developers and AI agents can send, receive and track email without fighting deliverability on their own.
published: 2026-11-13
updated: 2026-11-13
---
# What Is MTA-STS? Records, Policy File and Modes Explained

By [Dhrumil Barot](https://sendhq.cc/about.md#founder), Founder

MTA-STS tells sending mail servers to use verified TLS when delivering to your domain. See the TXT record, policy file, modes and TLS-RPT setup.

Published November 13, 2026 · Updated November 13, 2026

**TL;DR:** MTA-STS (RFC 8461) lets a domain tell sending mail servers "only deliver to my listed MX hosts, over TLS with a valid certificate." You publish a `_mta-sts` TXT record and a small text policy at `https://mta-sts.<domain>/.well-known/mta-sts.txt`, start in `testing` mode with TLS-RPT reports turned on, and switch to `enforce` once the reports are clean.

MTA-STS (SMTP MTA Strict Transport Security) is a standard that closes the gap left by opportunistic TLS between mail servers. By default, server-to-server SMTP on port 25 uses STARTTLS only if both sides offer it, does not check certificates, and quietly falls back to plaintext if the upgrade fails, so an attacker on the path can strip the `STARTTLS` offer or point delivery at their own server. MTA-STS fixes that for inbound mail to your domain: senders that support it fetch your policy over HTTPS, then refuse to deliver unless the receiving MX matches the policy, offers STARTTLS and presents a certificate that chains to a public CA and matches the MX hostname. It was published as RFC 8461 in September 2018, alongside its reporting companion TLS-RPT (RFC 8460). Gmail and Microsoft publish enforce-mode policies today; Yahoo publishes one in testing mode.

## Why does opportunistic TLS need MTA-STS?

Opportunistic TLS is encryption that is used when available and silently skipped when it is not. RFC 3207 (February 2002), which defines STARTTLS, even says a publicly referenced SMTP server must not require STARTTLS, because senders that cannot do TLS would be locked out. That design choice leaves three holes:

- **STARTTLS stripping:** a man in the middle deletes `250-STARTTLS` from the server's `EHLO` reply, and the sender continues in plaintext. Our [STARTTLS explainer](https://sendhq.cc/terms/starttls) shows the exchange line by line.
- **Certificate substitution:** most MTAs relaying on port 25 accept any certificate, so an attacker can encrypt to themselves.
- **MX spoofing:** without DNSSEC, a poisoned DNS answer can point your [MX record](https://sendhq.cc/terms/mx-record) at a host the attacker controls.

A concrete scenario: a payroll provider emails salary slips to `hr@example.com`. With opportunistic TLS, a compromised router on the path can downgrade the session and read every slip, and neither side logs an error. With an enforce-mode MTA-STS policy, the provider's server sees no STARTTLS (or a certificate for the wrong name), refuses to deliver, queues the message and retries later instead.

Note that this is transport security, not sender authentication. SPF, DKIM and DMARC prove who sent a message; MTA-STS keeps it private and unmodified on the way. See [DKIM, SPF and DMARC explained](https://sendhq.cc/guides/email-dkim-spf-dmarc.md) for the identity side.

## Which records and files make up MTA-STS?

MTA-STS is made of two parts: a DNS record that says a policy exists, and an HTTPS-hosted file that says what the policy is. HTTPS matters because it authenticates the policy through the Web PKI, so an attacker who can tamper with DNS cannot simply forge it.

![A sending server checks the TXT record, fetches the policy over HTTPS, then delivers only over verified TLS](https://cdn.sanity.io/images/l4lj7ros/production/801218ab2c8a0fa8fbba6533f5c60b1c3b67383a-1344x326.png?w=1280&auto=format)

The policy is cached for max_age seconds and reused on later deliveries.

**1. The \`\_mta-sts\` TXT record**

`_mta-sts.example.com. 3600 IN TXT "v=STSv1; id=20261113000000Z;"`

- `v=STSv1` is the only supported version.
- `id` is 1 to 32 letters or digits. Senders compare it with their cached copy, so **change it every time you edit the policy**, or senders keep the old policy until it expires. A UTC timestamp, as Microsoft recommends, is the easiest scheme.
- Publish exactly one record. If a resolver returns two valid `v=STSv1` records, RFC 8461 says to treat the domain as having no policy.

**2. The policy file**

Served at `https://mta-sts.example.com/.well-known/mta-sts.txt` with `Content-Type: text/plain`:

```
version: STSv1
mode: testing
mx: aspmx.l.google.com
mx: *.aspmx.l.google.com
max_age: 86400
```

- `mode`: `enforce`, `testing` or `none` (next section).
- `mx`: one line per MX host. A wildcard is allowed only as the whole leftmost label (`*.aspmx.l.google.com`). Every MX in your DNS must match a line, including backups.
- `max_age`: how long senders cache the policy, in seconds, up to 31557600 (about one year).

The host `mta-sts.example.com` needs a valid public certificate for that exact name. RFC 8461 adds strict fetch rules: only an HTTP 200 counts, **redirects are not followed**, HTTP caching is not used, and senders may give up after about one minute or 64 KB. A static host (GitHub Pages, Cloudflare Pages, Azure Static Web Apps, an S3 bucket behind a CDN) is enough. A common breakage is a host that redirects `/.well-known/mta-sts.txt` to a trailing slash or to `www`.

**3. What senders do with it**

A compliant sender looks for a cached policy, fetches a fresh one when the `id` changed or the cache expired, and refreshes it roughly once a day. If the TXT record exists but the policy cannot be fetched and nothing is cached, it delivers as if you had no MTA-STS. If DNS later fails but a cached policy is still valid, it keeps applying the cached one. That last rule is what makes MTA-STS resistant to an attacker who blocks the lookup after the first fetch.

## What do the testing, enforce and none modes mean?

The mode decides what a sender does when validation fails, defined in section 5 of RFC 8461:

| Mode | On validation failure | Reports sent (if TLS-RPT is set) | Use it for |
| --- | --- | --- | --- |
| `testing` | Delivers anyway, as without MTA-STS | Yes | First rollout and every MX change |
| `enforce` | Does not deliver; treats it as temporary and retries | Yes | Steady state |
| `none` | Treats the domain as having no policy | No | Removing MTA-STS safely |

In `enforce`, RFC 8461 says senders should treat the failure as transient, so mail queues rather than bouncing at once, and must re-check DNS for an updated policy before failing permanently. That gives you time to fix a broken certificate. Senders still return a bounce when their queue lifetime runs out: Exchange Online, for example, returns NDR `5.4.8` when the MX host is not in the policy and `5.7.5` when the certificate fails validation.

Video: [MTA-STS and TLS-RPT Setup with Hosted MTA-STS](https://www.youtube.com/watch?v=z6D7sN7ab4k) (PowerDMARC)

A short walkthrough of what MTA-STS protects and the three enforcement levels. It explains that testing relies on TLS-RPT data to spot certificate problems and recommends about two weeks of clean reports before moving to enforce.

1. [0:00](https://www.youtube.com/watch?v=z6D7sN7ab4k) What MTA-STS is and what it prevents
2. [0:25](https://www.youtube.com/watch?v=z6D7sN7ab4k&t=25s) Inbound TLS and the three levels
3. [0:48](https://www.youtube.com/watch?v=z6D7sN7ab4k&t=48s) Testing mode and what TLS reports show
4. [1:13](https://www.youtube.com/watch?v=z6D7sN7ab4k&t=73s) Moving to enforce after two weeks of data

## What is TLS-RPT?

TLS-RPT (SMTP TLS Reporting, RFC 8460) is a DNS record that asks sending servers to email you a daily summary of their TLS connections to your domain, including failures. It is how you learn about problems that happen on other people's servers:

`_smtp._tls.example.com. 3600 IN TXT "v=TLSRPTv1; rua=mailto:tls-reports@example.com"`

`rua` takes a `mailto:` address or an `https:` endpoint, comma-separated if you want several. Reports cover one full UTC day, arrive as gzip-compressed JSON (`application/tlsrpt+gzip`) and list the policy type (`sts`, `tlsa` or `no-policy-found`), successful and failed session counts, and a `result-type` for each failure. The ones you will see most:

| result-type | Usually means |
| --- | --- |
| `certificate-host-mismatch` | MX certificate does not cover the MX hostname |
| `certificate-expired` | Renewal failed on an MX host |
| `starttls-not-supported` | MX offers no STARTTLS, or something on the path strips it |
| `validation-failure` | Any other failure; read `failure-reason-code` (RFC 8460's own example is a backup MX) |
| `sts-policy-fetch-error` | Policy host down, redirecting or not returning 200 |
| `sts-webpki-invalid` | Certificate on `mta-sts.<domain>` is invalid or expired |

Publish TLS-RPT first. It costs nothing and gives you a baseline before any policy exists. Gmail does this itself: `_smtp._tls.gmail.com` sends reports to `sts-reports@google.com`.

## Worked example: rolling out MTA-STS with real numbers

Say `example.com` receives mail on Google Workspace. Its MX records are `aspmx.l.google.com` and `alt1` to `alt4.aspmx.l.google.com` (newer Workspace domains use the single MX `smtp.google.com`). Gmail's own policy (checked November 2026) uses `smtp.google.com`, `aspmx.l.google.com` and `*.aspmx.l.google.com` with `max_age: 86400`, so the same patterns cover every Workspace MX.

| Day | Change | max_age | Why |
| --- | --- | --- | --- |
| 0 | Publish `_smtp._tls` TXT | none | Baseline reports |
| 1 | Policy `mode: testing` with `mx:` lines `smtp.google.com`, `aspmx.l.google.com`, `*.aspmx.l.google.com`; TXT `id=20261114000000Z` | 86400 (1 day) | Mistakes expire within a day |
| 15 | Reports clean for 14 days: `mode: enforce`, new `id` | 86400 | Enforce with a short cache |
| 30 | Raise cache, new `id` | 604800 (7 days) | Microsoft's own value |
| 60 | Raise cache, new `id` | 1209600 (14 days) | Fewer refetches, smaller first-use gap |

Now say `example.com` moves its inbound mail to another provider on day 90. If it deletes the TXT record first, every sender that fetched the 14-day policy keeps enforcing it for up to 1,209,600 seconds and will refuse the new MX hosts. RFC 8461 section 8.3 gives the safe order: publish `mode: none` with `max_age: 86400` and a new `id`, wait at least 14 days (the longest `max_age` you ever served), then remove the record and the policy host. For a simple MX swap you can skip removal and just add the new hosts to the `mx:` lines with a new `id` before you change DNS.

![The safe removal path steps the policy down to none and waits out the old cache before deleting anything](https://cdn.sanity.io/images/l4lj7ros/production/a14a493c273717989cb7246613a5c86479951b9e-1344x410.png?w=1280&auto=format)

Senders keep a cached policy for max_age seconds even after the DNS record is gone.

## How does MTA-STS differ from STARTTLS and DANE?

STARTTLS is the encryption mechanism; MTA-STS and DANE are two ways to make it mandatory and authenticated. They solve the same problem with different trust anchors.

STARTTLS alone | MTA-STS | DANE (RFC 7672)

| What it adds | Encryption, if both sides offer it | A rule that TLS is required, plus MX allowlist | Same, pinned to keys in DNS |
| --- | --- | --- | --- |
| Trust anchor | None by default | Public CAs (Web PKI) | DNSSEC |
| Published as | Server capability | `_mta-sts` TXT + HTTPS policy | TLSA at `_25._tcp.<mx host>` |
| Needs DNSSEC | No | No | Yes |
| First-contact protection | No | No, needs a cached policy | Yes |
| Works with hosted MX (Gmail, Exchange Online) | Yes | Yes | Only if the provider publishes TLSA |

Use MTA-STS if you cannot sign your zone with DNSSEC or your MX is a hosted provider, which covers most companies. Add DANE if you run DNSSEC and your own MTAs. You can publish both: RFC 8461 says a sender must not let an MTA-STS pass override a failed DANE check. For how STARTTLS compares with implicit TLS on submission ports, see [SMTP SSL vs TLS](https://sendhq.cc/blog/smtp-ssl-vs-tls).

## Do I need MTA-STS if I only send email through a provider?

No, not for sending. MTA-STS protects mail **coming into** your domain; your policy tells other servers how to deliver to your MX hosts. Whether your outbound mail honors recipients' policies depends on your provider's sending MTAs, not on any record you publish. Exchange Online validates MTA-STS on all outbound mail with no setting to change. Amazon SES documents opportunistic TLS by default and a configuration-set option, `TlsPolicy: REQUIRE`, that refuses to send without TLS; its security documentation does not describe MTA-STS validation, so check with your provider if this matters for your recipients.

You do need it if the same domain receives mail: a support inbox, replies to transactional mail, or an inbound parsing address. In that case list whichever MX hosts actually receive. For Cloudflare Email Routing, for example, the MX hosts are `route1`, `route2` and `route3.mx.cloudflare.net`, and their certificate (checked November 2026) covers `*.mx.cloudflare.net`, so `mx:` lines for those three names validate. Prefer exact names over a shared wildcard when other tenants use the same suffix.

That inbound case is where SendHQ fits: its inbound email turns mail sent to your verified domain into structured messages and webhooks, received through Cloudflare Email Routing. If you are setting that up, [SendHQ](https://sendhq.cc/index.md) handles the domain verification and inbound routing, and you can add the MTA-STS policy above for the same MX hosts.

## Pitfalls that break MTA-STS rollouts

- **Forgetting to change the \`id\`:** senders keep the old policy until `max_age` runs out, so a newly added MX fails enforcement.
- **Policy host certificate expiry:** `mta-sts.<domain>` is often a forgotten static site. When its certificate lapses, reports fill with `sts-webpki-invalid`.
- **Redirects:** a `301` from the policy URL is a fetch error, even if the target is correct.
- **A missing backup MX:** every MX in DNS must match an `mx:` line.
- **Shared wildcards:** Microsoft notes `*.mail.protection.outlook.com` is safe only because Exchange Online lets one organization receive for a domain; that is not true of every provider.

Run your domain through our [email DNS checker](https://sendhq.cc/tools/email-dns-checker.md) after publishing to confirm the MX, SPF and DMARC records alongside the new ones. Google Workspace admins also get a validator under Apps > Google Workspace > Gmail > Compliance > MTA-STS.

## FAQ

### What is MTA-STS in simple terms?

MTA-STS is a published rule that says "deliver mail to my domain only over TLS, only to these servers." Sending servers that support it check your rule before delivering and refuse to send in plaintext or to an unlisted server.

### Is MTA-STS required for Gmail or Yahoo bulk sender rules?

No. The 2024 Gmail and Yahoo sender requirements center on SPF, DKIM, DMARC, one-click unsubscribe and spam rates. MTA-STS is recommended by Google for domains that receive mail but is not part of the bulk sender rules.

### Where do I host the mta-sts.txt file?

On any HTTPS host that serves `https://mta-sts.<domain>/.well-known/mta-sts.txt` with a valid certificate for that exact hostname, a 200 response, no redirects and `text/plain` content. Exchange Online and Google Workspace do not host it for you.

### What max_age should I use?

Use 86400 (one day) while testing and right after switching to enforce. Then raise it in steps to one or two weeks; Microsoft uses 604800. RFC 8461 allows up to 31557600, but a long value makes mistakes and migrations last longer.

### Does MTA-STS stop spoofing or phishing?

No. It protects messages in transit to your domain. Spoofing of your domain as a sender is handled by SPF, DKIM and a DMARC policy.

### How do I check if a domain has MTA-STS?

Query the TXT record (`dig TXT _mta-sts.example.com`) and fetch the policy (`curl https://mta-sts.example.com/.well-known/mta-sts.txt`). A working setup returns one `v=STSv1` record and a policy whose `mx:` lines match the domain's MX records.

Sources: [RFC 8461, SMTP MTA Strict Transport Security](https://www.rfc-editor.org/rfc/rfc8461), [RFC 8460, SMTP TLS Reporting](https://www.rfc-editor.org/rfc/rfc8460), [Microsoft Learn: Enhance mail flow with MTA-STS](https://learn.microsoft.com/en-us/purview/enhancing-mail-flow-with-mta-sts), [Amazon SES security protocols](https://docs.aws.amazon.com/ses/latest/dg/security-protocols.html), [Google Workspace: About MTA-STS and TLS reporting](https://knowledge.workspace.google.com/admin/gmail/advanced/about-mta-sts-and-tls-reporting).

## Keep reading

- [SMTP Commands Reference: EHLO to QUIT, With Reply Codes](https://sendhq.cc/blog/smtp-commands): Every SMTP command with its syntax, the reply codes it can return, and an annotated session with STARTTLS and AUTH, plus what 503 bad sequen Read article →
- [GoDaddy DKIM: How to Add a DKIM Record in GoDaddy DNS](https://sendhq.cc/blog/godaddy-dkim): Add GoDaddy DKIM for Microsoft 365, Google Workspace, Amazon SES or an email API: the exact record type, the host-only Name rule, dig checks Read article →
- [SMTP SSL vs TLS: Which to Pick, STARTTLS or Implicit TLS](https://sendhq.cc/blog/smtp-ssl-vs-tls): For SMTP, use TLS: SSL is deprecated. Pick implicit TLS on port 465 when offered, or STARTTLS on 587. Ports, RFCs and client settings explai Read article →
