MTA-STS & TLS-RPT DNS Setup (Enforced SMTP Encryption)

Interactive MTA-STS policy generator and DNS cheatsheet to enforce TLS 1.2+/1.3 encryption on inbound email delivery.

RFC 8461 MTA-STSRFC 8460 TLS-RPTAnti-Downgrade

Copy-Ready DNS Records & Configuration

Host / NameTypeValueTTLPurpose
_mta-sts TXT v=STSv1; id=2026112901 3600 Signals MTA-STS support; bump id= whenever policy file changes
_smtp._tls TXT v=TLSRPTv1; rua=mailto:tls-reports@yourdomain.com 3600 Daily JSON reports of SMTP TLS failures
mta-sts CNAME/A Cloudflare Pages / Workers / Nginx HTTPS endpoint 3600 Serves /.well-known/mta-sts.txt over valid HTTPS

Interactive MTA-STS & TLS-RPT Policy Generator

DNS TXT Records (_mta-sts & _smtp._tls)

      
HTTPS Policy File (/.well-known/mta-sts.txt)

    

Step-by-Step Deployment Checklist

  1. Host a plain-text policy file at `https://mta-sts.yourdomain.com/.well-known/mta-sts.txt` with `mode: testing` and your exact MX hostnames.
  2. Publish `_mta-sts.yourdomain.com` TXT (`v=STSv1; id=YYYYMMDD01`) and `_smtp._tls.yourdomain.com` TXT (`v=TLSRPTv1; rua=mailto:...`).
  3. Monitor TLS-RPT JSON reports for 14 days to confirm zero certificate or MX-matching errors.
  4. Switch `mode: testing` to `mode: enforce`, increase `max_age: 604800` (or `2419200`), and bump the `id=` timestamp in `_mta-sts` TXT.

Common Pitfalls to Avoid

JetBrains Plugin + Gumroad

Never Commit SMTP Passwords, DKIM Private Keys, or API Secrets to Git

EnvGuard for JetBrains IDEs scans .env, YAML, and DNS config files locally before commit — paired with our DevOps & AI Automation Kits on Gumroad.

Frequently Asked Questions

Why isn't standard STARTTLS enough for email security?

Opportunistic STARTTLS can be silently stripped by an active network attacker (downgrade attack) and does not verify the MX server's certificate against your domain. MTA-STS enforces valid TLS.

Can I host mta-sts.txt on Cloudflare Pages or Workers for free?

Yes! Cloudflare Workers or Cloudflare Pages can serve `/.well-known/mta-sts.txt` on `mta-sts.yourdomain.com` with automatic SSL at $0/month.

How does MTA-STS compare to DANE?

DANE relies on DNSSEC TLSA records (great for self-hosted Postfix), while MTA-STS uses standard HTTPS + TXT records and is widely supported by Gmail, Google Workspace, and Microsoft 365.

Related DNS & Email Auth Guides