Email & DNS

EMAIL & DNS

MTA-STS & TLS-RPT generator

Create everything MTA-STS needs: the policy file, the _mta-sts TXT record and a TLS-RPT record for reports. Check a domain to load its published setup and verify it against the MX records.

Mode

Senders check the policy and send reports, but still deliver when TLS fails.

Policy file

Location: https://mta-sts.example.com/.well-known/mta-sts.txt

version: STSv1
mode: testing
mx: mail.example.com
max_age: 604800

MTA-STS record

Location: _mta-sts.example.com. TXT

v=STSv1; id=20261203025133

TLS-RPT record

Location: _smtp._tls.example.com. TXT

v=TLSRPTv1; rua=mailto:tls-reports@example.com

The host mta-sts.example.com needs an A/AAAA or CNAME record and a valid, publicly trusted TLS certificate. Senders do not follow redirects.

Whenever you change the policy file, publish the new id in the _mta-sts record as well – otherwise senders keep using their cached policy.

nginx configuration

nginx configuration

Location: /etc/nginx/sites-available/mta-sts.example.com

server {
	listen 443 ssl;
	listen [::]:443 ssl;
	http2 on;
	server_name mta-sts.example.com;

	ssl_certificate /etc/letsencrypt/live/mta-sts.example.com/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/mta-sts.example.com/privkey.pem;

	location = /.well-known/mta-sts.txt {
		default_type text/plain;
		return 200 "version: STSv1\r\nmode: testing\r\nmx: mail.example.com\r\nmax_age: 604800\r\n";
	}

	location / {
		return 404;
	}
}

Frequently asked questions

What is MTA-STS?

SMTP encrypts opportunistically: an attacker in the network path can suppress STARTTLS and read mail in plain text. MTA-STS (RFC 8461) lets a domain publish that its MX servers support TLS with valid certificates, so sending servers refuse unencrypted or spoofed connections.

Which parts does MTA-STS need?

Three: a TXT record at _mta-sts.<domain> with a policy id, a web server for mta-sts.<domain> with a valid certificate, and the policy file at /.well-known/mta-sts.txt listing mode, MX hosts and max_age. All MX servers must offer STARTTLS with a certificate that matches their host name.

What is TLS-RPT?

SMTP TLS Reporting (RFC 8460) is a TXT record at _smtp._tls.<domain> naming addresses for daily reports. Large providers like Google and Microsoft send JSON reports about successful and failed TLS connections to your servers – essential to spot problems before switching to enforce.

How do I switch from testing to enforce?

Run testing with a short max_age for a few weeks and read the TLS reports. When they show no failures, set mode to enforce, raise max_age to at least a week and publish a new id in the _mta-sts record.

What is the difference to DANE?

DANE pins the certificate via TLSA records and requires DNSSEC. MTA-STS works without DNSSEC and relies on public certificate authorities and HTTPS instead. Both can be used together; senders that support DANE prefer it.