MTA-STS Record & Policy Generator: Build RFC 8461 TXT and mta-sts.txt Files

Generate a standards-compliant _mta-sts DNS TXT record, a /.well-known/mta-sts.txt HTTPS policy file (RFC 8461), and a companion _smtp._tls TLS-RPT reporting record (RFC 8460) by auto-detecting your domain's live MX servers over DNS-over-HTTPS.

100% Free · No Sign Up ⚡ Instant Live Query 🛡️ Browser DoH · Nothing Stored by Us
DNS-over-HTTPS
Try instantly:

Enter a domain above to fetch its live MX records and build the three artifacts.

What This Result Means: 3 MTA-STS Policy Modes and Deployment Requirements

Every generated policy resolves into one of the deployment states below, plus the cache rule that governs when senders re-fetch it:

StateObserved ConditionWhat Sending Servers DoWhat It Means for Your Domain
1. testing Mode (Safe Initial Rollout with TLS-RPT)mode: testing with a working _smtp._tls reporting recordSenders apply the policy for reporting only: TLS/MX failures are reported via TLS-RPT but mail is still deliveredThe correct first state: you see every violation before anything is dropped.
2. enforce Mode (Mandatory TLS 1.2/1.3 & Valid X.509 Certificate)mode: enforce after a clean reporting periodSenders refuse delivery over unauthenticated channels: the MX must present a valid certificate and match an mx: lineFull downgrade protection: active attackers cannot strip STARTTLS on your inbound mail.
3. none Mode (Policy Decommissioning)mode: none published while retiring MTA-STSSenders stop enforcing immediately but keep the discovery record until max_age expiresThe safe off switch: never just delete the records, publish none first.
4. Policy ID (id=) Cache Invalidation RuleThe _mta-sts TXT id= value versus the cached policy copySenders re-fetch the HTTPS policy only when the DNS id= changes or their cached copy exceeds max_ageEvery policy edit needs a new id=, or cached senders enforce the stale version.

How to Deploy MTA-STS and TLS-RPT in 4 Steps

The generator produces the artifacts; deployment is a 4-step sequence:

  1. Host. Host the generated file at https://mta-sts.yourdomain/.well-known/mta-sts.txt with a valid TLS certificate and no redirects: a subdomain on Cloudflare Pages/Workers, an Nginx server block, or an S3 bucket behind CloudFront all work, as long as the response is 200 with Content-Type: text/plain (RFC 8461 section 3.3 forbids following 301/302 redirects).
  2. Verify. Verify every MX server in the policy presents a TLS 1.2 or 1.3 certificate whose SAN matches the MX hostname: senders check the certificate against the MX name they connect to, not against your domain.
  3. Publish. Publish both DNS records from the generator: the _mta-sts TXT discovery record and the companion _smtp._tls TLS-RPT record with your rua= mailbox.
  4. Advance. Advance from testing to enforce only after your TLS-RPT reports show a clean period: switch the mode, bump the id=, redeploy the policy file, and keep both records in sync.

Verify Your Generated MTA-STS Policy From the Command Line (dig and curl)

# The discovery record (id= must change whenever the policy changes):
dig TXT _mta-sts.example.com +short

# The TLS-RPT companion record:
dig TXT _smtp._tls.example.com +short

# The policy file: expect HTTP 200, text/plain, and no redirect:
curl -sI https://mta-sts.example.com/.well-known/mta-sts.txt
curl -s https://mta-sts.example.com/.well-known/mta-sts.txt

Reference Table: MTA-STS Policy Keys, DNS Tags, and Provider MX Patterns (RFC 8461)

Two references in one: the keys each artifact can carry, and the standard mx: lines for the major mailbox platforms:

Key / TagArtifactValuesMeaning (RFC 8461 / RFC 8460)
version: STSv1mta-sts.txtSTSv1 (fixed)Policy format version; required first key.
mode:mta-sts.txttesting, enforce, noneEnforcement level applied by sending servers.
mx:mta-sts.txtHostname or leftmost wildcard, one per lineThe only MX hostnames senders may deliver to in enforce mode.
max_age:mta-sts.txtSeconds (86400 to 31557600)How long senders may cache the policy; 31557600 is the maximum.
v=STSv1_mta-sts TXTSTSv1 (fixed)Discovery record version.
id=_mta-sts TXTUp to 32 alphanumeric ASCII charactersPolicy version tag: change it on every policy edit to invalidate caches.
v=TLSRPTv1_smtp._tls TXTTLSRPTv1 (fixed)TLS reporting discovery record version (RFC 8460).
rua=_smtp._tls TXTmailto: or https: URIWhere TLS failure reports are delivered.
ProviderStandard mx: policy lines
Google Workspaceaspmx.l.google.com
*.aspmx.l.google.com
*.googlemail.com
Microsoft 365*.mail.protection.outlook.com
Proton Mailmail.protonmail.ch
mailsec.protonmail.ch
Zoho Mailmx.zoho.com
mx2.zoho.com
mx3.zoho.com
Fastmailin1-smtp.messagingengine.com
in2-smtp.messagingengine.com

What This Tool Does Not Check

  • Generating the artifacts does not host them: the https://mta-sts.yourdomain/.well-known/mta-sts.txt file must be deployed on your own web infrastructure with a valid certificate.
  • RFC 8461 section 3.3 forbids redirects: a 301/302 on the policy URL (a common side effect of www-redirect rules or HTTP-to-HTTPS hops on the wrong hostname) makes senders treat the policy as absent, and this generator cannot see your web server config.
  • Every mx: server must present a valid X.509 TLS 1.2 or 1.3 certificate matching the MX hostname: the generator writes the lines, but certificate validation happens when senders connect.
  • Live validation of a deployed policy is a different check: run the MTA-STS checker after hosting the file and publishing the records.

What We See Across Domains

The dominant real-world MTA-STS failure is not the policy content but the hosting: the mta-sts.yourdomain subdomain sits behind an HTTP-to-HTTPS or www redirect rule inherited from the apex web server, and RFC 8461 parsers reject the redirect as a missing policy. The second pattern is Microsoft 365 domains adopting the wildcard *.mail.protection.outlook.com mx: line, which is exactly what the leftmost-wildcard rule exists for: tenant MX hostnames change per datacenter, and the wildcard covers every variant.

Frequently Asked Questions

What is MTA-STS and why do I need both a DNS TXT record and an HTTPS file?+

The _mta-sts DNS TXT record is the discovery mechanism: it tells sending servers that your domain supports MTA-STS and carries an id= that changes whenever the policy changes. The actual rules (mode, allowed MX hosts, max_age) live in the mta-sts.txt file served over HTTPS on the mta-sts. hostname. The split keeps the DNS record tiny while the policy file can carry as many mx: lines as your infrastructure needs.

Which MTA-STS mode should I start with: testing or enforce?+

Start with testing. In testing mode, sending servers that fail the TLS or MX checks still deliver the mail but report the failure through TLS-RPT, so you can confirm every legitimate MX path passes before anything is dropped. Move to enforce only after the reports show a clean period.

Why must I change the id= value in _mta-sts TXT whenever I edit mta-sts.txt?+

Sending servers cache the policy file until the id= changes or max_age expires. If you edit mta-sts.txt without changing id=, cached senders keep enforcing the old policy, so new MX hosts stay unauthorized and enforcement can bounce legitimate mail.

Can the https://mta-sts.example.com/.well-known/mta-sts.txt URL use a 301 redirect?+

No, RFC 8461 section 3.3 forbids redirects: the policy must be served directly with HTTPS and a valid certificate on the mta-sts. hostname. A 301 or 302 to another URL causes sending servers to treat the policy as absent.

How do wildcard mx: rules work in an mta-sts.txt policy file?+

An mx: line may use a leftmost wildcard, such as *.mail.protection.outlook.com, which authorizes any hostname matching that pattern. The wildcard covers only one label at the leftmost position: mail.protection.outlook.com itself must be listed separately if your MX records point at the bare host.

Next Checks

Last verified: 2026-11-10