DNS security
What Is MTA-STS? SMTP Strict Transport Security Explained
MTA-STS lets a domain require encrypted, certificate-checked delivery of incoming mail. Learn the TXT record and policy file, the testing and enforce modes, how senders cache policies, TLS-RPT reports, DANE, and a safe deployment and removal plan.
By MailConfig.pro TeamPublished 8 min read

On this page
MTA-STS (SMTP MTA Strict Transport Security) is a standard that lets a domain require encrypted, authenticated delivery of the mail sent to it. The domain publishes a policy that lists its mail servers and tells other servers to deliver only over TLS with a valid certificate. A sending server that supports MTA-STS then refuses to hand over mail through an unencrypted connection or to a server that isn't on the list. This closes the gap in normal email delivery, where encryption is optional and an attacker on the network can silently remove it. MTA-STS is defined in RFC 8461.
The problem MTA-STS solves
Mail servers encrypt delivery with STARTTLS: the connection starts in plain text, and the receiving server offers to switch to TLS. That design has two weaknesses:
- Downgrade. An attacker between the two servers can strip the STARTTLS offer from the conversation. The sender sees a server that doesn't support encryption and, by default, delivers the message in plain text anyway.
- No certificate check. Most senders encrypt without verifying the receiving server's certificate, because mail servers historically used self-signed or mismatched certificates. An attacker who can redirect the connection can present any certificate and read the mail.
MTA-STS fixes both for domains that opt in. The policy tells senders in advance that your servers support TLS, and which certificate names to expect, so a missing STARTTLS offer or a bad certificate is treated as an attack instead of being accepted quietly.
MTA-STS protects incoming mail to your domain. It has nothing to do with sender authentication: DMARC, SPF and DKIM prove who sent a message, while MTA-STS protects the connection the message travels over.
How MTA-STS works
MTA-STS has two parts: a TXT record in DNS that announces the policy, and the policy file itself, served over HTTPS.
1. The TXT record
_mta-sts.example.comv=STSv1; id=20261204120000v=STSv1is the version and must come first.idis a label for the current policy, up to 32 letters and digits. Senders compare it with the id of the policy they have cached. Change the id every time you change the policy, or senders keep using the old one. A date and time works well.
2. The policy file
Senders fetch the policy from a fixed URL: https://mta-sts.example.com/.well-known/mta-sts.txt. The host name always starts with mta-sts. followed by your domain, and the server needs a valid certificate from a public certificate authority for that name. The file is plain text (text/plain):
version: STSv1
mode: testing
mx: mail.example.com
mx: backup-mx.example.com
max_age: 604800
| Field | Meaning |
|---|---|
version |
Always STSv1 |
mode |
testing, enforce or none (see below) |
mx |
A mail server that may receive mail for the domain. One line per server. A wildcard such as *.example.net matches exactly one label, so it covers mx1.example.net but not example.net or a.b.example.net |
max_age |
How long senders may cache the policy, in seconds, up to 31,557,600 (about a year) |
RFC 8461 adds a few rules for the HTTPS fetch: senders don't follow redirects, accept only a 200 response, and may give up after about a minute or 64 KB. Serve the file directly from the mta-sts. host.
What a sender does
When a server that supports MTA-STS has mail for your domain, it:
- Looks for a cached policy that hasn't expired. If none exists, or the
idin your TXT record has changed, it fetches the policy file. - Checks each MX host it tries against the policy's
mxlines, and requires STARTTLS with a certificate that is valid for that host name, unexpired and issued by a trusted authority (sections 4.1 and 4.2). - Applies the policy mode if a check fails.
The three modes
| Mode | What senders do when a check fails |
|---|---|
testing |
Deliver as if there were no policy, and report the failure through TLS-RPT if you publish a reporting address |
enforce |
Don't deliver to that server. Try the next MX, and treat the message as a temporary failure so it is retried later |
none |
Treat the domain as having no policy. Used to switch MTA-STS off cleanly |
In enforce mode, a sender must check your DNS for a newer policy before it gives up on a message for good (section 5). That lets you fix a broken policy and have queued mail delivered once senders pick up the new id.
Always start in testing mode. Microsoft and Google both recommend it in their setup guides: run in testing, read the reports, fix what they show, then switch to enforce.
TLS-RPT: the reports that make testing useful
Testing mode is only useful if you can see the failures. That is the job of SMTP TLS Reporting (TLS-RPT, RFC 8460), a separate TXT record:
_smtp._tls.example.comv=TLSRPTv1; rua=mailto:tls-reports@example.comSending servers that support it send a JSON report, usually gzip-compressed and covering one UTC day, to that address. It counts successful TLS sessions and lists failures by type, such as starttls-not-supported, certificate-expired, validation-failure or sts-policy-fetch-error. rua also accepts an https: URL for reports sent by HTTP POST.
Reports sent by email must carry a valid DKIM signature from the reporting domain, and senders deliver them even when TLS fails, so the report can arrive over an unencrypted connection. Use a mailbox that accepts that. Google notes that you may not receive many reports until more mail providers support TLS reporting. Check your record with the TLS-RPT checker.
Who supports MTA-STS
Support is on the sending side: a policy only protects mail from servers that check it.
- Microsoft Exchange Online checks MTA-STS on all outbound mail automatically, and returns errors such as 5.4.8 when the recipient's MX hosts fail an enforced policy. For inbound mail it supports MTA-STS for domains whose MX points to Exchange Online, but it can't host the policy file for you, so you host it yourself. Microsoft's example policy for such domains uses
mx: *.mail.protection.outlook.com. - Gmail delivers messages from Google Workspace domains in compliance with MTA-STS when the receiving domain's policy is in enforce mode. Google's setup guide for your own domain asks for mail servers that support TLS 1.2 or higher.
Copy the mx values for your own policy from your mail provider's documentation. They must match the host names in your MX records, and each one must have a certificate valid for that name.
How to deploy MTA-STS safely
- Check your mail servers. Every MX host must support STARTTLS and present a certificate that is valid, unexpired and issued for its own host name. The SMTP checker tests STARTTLS, the TLS version and the certificate of each MX host.
- Publish TLS-RPT first, so reports start arriving as soon as the policy goes live.
- Host the policy file at
https://mta-sts.<your domain>/.well-known/mta-sts.txtwith a valid certificate for that host, intestingmode, listing every MX host. - Publish the
_mta-stsTXT record with a new id. - Read the reports for a week or two. Fix any MX host that fails, and any host missing from the
mxlines. - Switch to
enforce. Update the file first, then change the id in the TXT record. Raisemax_ageto several weeks once the policy is stable.
Whenever you change the policy later, including adding a new mail server, update the file before the TXT record. RFC 8461 recommends this order so senders who see the new id don't fetch and cache the old file (section 8.1). If you change mail providers, add the new MX hosts to the policy before you change your MX records, or enforced senders will refuse to deliver to them.
Removing MTA-STS
Don't just delete the records. Senders keep an enforced policy cached for up to max_age, and deleting the TXT record doesn't clear that cache. RFC 8461 describes a clean exit (section 8.3):
- Publish a policy with
mode: noneand a shortmax_age, such as one day. - Change the id in the TXT record so senders fetch it.
- Wait until every previously served policy has expired, then remove the TXT record and the policy file.
Limits of MTA-STS
- First contact is unprotected. A sender that has never fetched your policy can be stopped from discovering it by an attacker who blocks the DNS lookup. Caching closes this for later deliveries, which is why long
max_agevalues are recommended (section 10.2). - It depends on public certificates. MTA-STS trusts the same certificate authorities as web browsers. A wrongly issued certificate for your
mta-sts.host or your MX hosts could undermine it. - The
mta-sts.host is a dependency. If the policy host lapses or points to a service you no longer use, senders can't fetch your policy, and an expired cached policy is not renewed. Keep it in the same inventory as your other DNS records that point to outside services.
MTA-STS vs DANE
DANE for SMTP (RFC 7672) solves the same problem with TLSA records protected by DNSSEC instead of a policy file and public certificates. It has no first-contact gap, but requires DNSSEC on your domain and on the MX hosts' domain. The two can run side by side: RFC 8461 says a sender that checks both must not let a passing MTA-STS check override a failing DANE check.
Checking MTA-STS with MailConfig.pro
The free MTA-STS checker looks up your _mta-sts record, fetches the policy over HTTPS, validates its syntax and content type, warns about a short max_age, and checks that the policy covers all of your MX hosts. In a MailConfig.pro account, the DNS security checks inspect your MTA-STS and TLS-RPT records together with DMARC, SPF and DKIM.
Frequently asked questions
What is MTA-STS in simple terms?
It is a policy a domain publishes to tell other mail servers: deliver mail to us only over encrypted TLS, only to these mail servers, and only if their certificate is valid. Without it, a sending server falls back to unencrypted delivery when encryption fails.
Does MTA-STS protect the mail I send?
No. Your MTA-STS policy protects mail that other servers deliver to your domain. Mail you send is protected by the recipient's policy, if their domain publishes one and your mail server checks it.
What is the difference between MTA-STS and TLS-RPT?
MTA-STS is the policy that requires verified TLS. TLS-RPT (RFC 8460) is a separate DNS record that asks senders to send you daily reports about TLS connection successes and failures, including MTA-STS policy problems. Deploy them together.
Which max_age should I use?
RFC 8461 expects weeks or more in normal use; its maximum is 31,557,600 seconds, about a year. Microsoft and Google both use 604,800 seconds (one week) in their example policies. Start with about a week in testing mode and raise it once the policy is stable.
Do I need DNSSEC for MTA-STS?
No. MTA-STS relies on HTTPS and public certificate authorities instead of DNSSEC. DANE, the alternative, requires DNSSEC.
References
- RFC 8461: SMTP MTA Strict Transport Security (MTA-STS), sections 2, 3.1-3.3, 4, 5, 8.1-8.3 and 10.2
- RFC 8460: SMTP TLS Reporting, sections 3 and 4
- RFC 7672: SMTP Security via Opportunistic DANE TLS
- Microsoft Learn: Enhance mail flow with MTA-STS (Exchange Online)
- Google Workspace Admin Help: About MTA-STS and TLS reporting
- Google Workspace Admin Help: Create an MTA-STS policy
mta ststlstls rptsmtpstarttls
Related articles
Best practices
Gmail, Yahoo and Outlook Sender Requirements: What Your Domain Needs
A checklist of what Gmail, Yahoo and Outlook.com each require from your sending domain, taken from the providers' own pages and dated November 2026: who counts as a bulk sender, the authentication minimums, one-click unsubscribe, spam-rate limits, PTR and TLS.
· 8 min read
DMARC
What Is DMARC? How Email Authentication Fits Together
DMARC is a DNS record that ties SPF and DKIM to the domain in the visible From address, states what receivers should do with mail that fails, and requests reports. This guide covers alignment, the record syntax, policies, reporting and what happens when a domain has no record.
· 10 min read
DNS security
SPF Hijacking: How Dangling CNAMEs and Typos Let Spoofing Pass DMARC
Some spoofed mail passes DMARC because attackers took over a name your DNS still trusts: a CNAME to an expired domain, a mistyped include, or a CIDR typo. How the takeover works, how to spot it in DNS and in DMARC aggregate reports, and how to close it.
· 8 min read
DKIM
What Is DKIM? DomainKeys Identified Mail Explained
DKIM adds a cryptographic signature to every message, and receivers verify it with a public key in your DNS. This guide covers the DKIM-Signature header, selectors and key records, key sizes and Ed25519, key rotation, forwarding and mailing lists, and how DKIM alignment makes DMARC work.
· 6 min read



