Home / Guides / How to Configure MTA-STS and TLS-RPT to Enforce SMTP Encryption
How to Configure MTA-STS and TLS-RPT to Enforce SMTP Encryption
Most mail servers support STARTTLS, which upgrades a plain SMTP connection to TLS after the servers say hello. The catch is that STARTTLS is opportunistic by default. If an active network attacker strips the STARTTLS line from the greetingโor presents an invalid or rogue certificateโthe sending server typically falls back to unencrypted delivery or accepts the untrusted certificate without failing.
MTA-STS (Mail Transfer Agent Strict Transport Security, RFC 8461) closes that gap. It lets a domain publish a signed-over-HTTPS policy telling sending mail servers which MX hostnames are valid and requiring a trusted, non-expired TLS certificate before any email is transmitted. Paired with TLS-RPT (RFC 8460), you receive daily JSON reports whenever a sender encounters a TLS failure.
Before setting up MTA-STS, make sure your core authentication records (SPF, DKIM and DMARC) are already in place with our Email Security Checker and DKIM Selector Lookup.
How MTA-STS prevents SMTP downgrade attacks
Without MTA-STS, DNS MX lookups are unauthenticated unless DNSSEC is deployed everywhere, and opportunistic STARTTLS cannot distinguish between a server that genuinely lacks TLS and an attacker stripping encryption.
When a sending server supports MTA-STS, it follows three rules:
- Look up
_mta-sts.<domain>via DNS TXT to check whether the domain publishes a policy and read itsid=. - Fetch
https://mta-sts.<domain>/.well-known/mta-sts.txtover HTTPS with strict certificate validation and cache the policy formax_ageseconds. - Verify that the receiving MX serverโs hostname matches one of the
mx:lines in the policy and presents a valid TLS certificate covering that hostname. Inenforcemode, delivery is aborted or deferred instead of falling back to plain text.
Step 1: Publish the _mta-sts DNS TXT record
Create a TXT record on the _mta-sts subdomain of your mail domain (for example, _mta-sts.example.com):
Host: _mta-sts
Type: TXT
Value: v=STSv1; id=20261205T01
Key rules for the DNS record:
v=STSv1is required and case-sensitive.id=must be 1 to 32 alphanumeric characters (A-Z,a-z,0-9). Do not use hyphens or underscores.- Whenever you update
mta-sts.txt, change theid=value (for example, increment a timestamp such as20261205T02). Sending MTAs use a changedid=as the signal to re-fetch your policy beforemax_ageexpires. - Publish only one
v=STSv1TXT record per domain.
Step 2: Host /.well-known/mta-sts.txt over HTTPS
Next, set up a web endpoint at https://mta-sts.example.com/.well-known/mta-sts.txt with a valid TLS certificate for mta-sts.example.com.
Start in testing mode so you can collect failure reports without risking bounced mail:
version: STSv1
mode: testing
mx: mail1.example.com
mx: *.mail.protection.outlook.com
max_age: 604800
Pay close attention to the RFC 8461 requirements for this file:
- No HTTP redirects:
https://mta-sts.example.com/.well-known/mta-sts.txtmust returnHTTP 200directly withContent-Type: text/plain. Redirects (301/302) are explicitly forbidden by RFC 8461 and cause compliant MTAs to treat the policy fetch as failed. - Exact
mx:patterns: Every MX host returned by your domainโsMXrecords must match anmx:line. Wildcards are permitted only on the leftmost label (for example*.google.comor*.mail.protection.outlook.com). - Reasonable
max_age: Setmax_agein seconds.86400is 1 day,604800is 7 days and1209600is 14 days. Keep it at a day or two while testing, then raise it to at least one week once enforced.
Step 3: Enable TLS-RPT (_smtp._tls)
Before switching mode: testing to mode: enforce, publish a TLS-RPT TXT record at _smtp._tls.example.com:
Host: _smtp._tls
Type: TXT
Value: v=TLSRPTv1; rua=mailto:[email protected]
You can also specify an HTTPS collector endpoint or list multiple destinations separated by commas:
v=TLSRPTv1; rua=mailto:[email protected],https://reports.example.com/v1/tlsrpt
Wait at least one to two weeks and monitor incoming reports for certificate mismatches, expired certs on backup MX hosts, or missing mx: entries. Once the reports are clean, update mta-sts.txt to mode: enforce and bump the id= tag in _mta-sts.
Next step: BIMI for inbox brand trust
Once your domain enforces DMARC (p=quarantine at pct=100 or p=reject) and protects transport encryption with MTA-STS, you can add BIMI (Brand Indicators for Message Identification) at default._bimi.example.com:
Host: default._bimi
Type: TXT
Value: v=BIMI1; l=https://example.com/brand/logo.svg; a=https://example.com/brand/vmc.pem
l=points to a square SVG Tiny PS logo served over HTTPS.a=points to your Verified Mark Certificate (VMC) PEM file, which providers such as Gmail require before displaying your logo next to messages.
Verify your live setup
Publishing a typo in mta-sts.txt, forgetting to update id=, or accidentally serving mta-sts.<domain> behind a 301 redirect silently breaks enforcement. Test your _mta-sts TXT record, live mta-sts.txt policy file, _smtp._tls reporting record and default._bimi tag in one pass with our MTA-STS, TLS-RPT & BIMI Checker.