Skip to content
deliverly.ai

Mail transport security

MTA-STS Generator

Build the policy file and both DNS records from your live MX hosts.

Already published? Open the MTA-STS checker

1

Domain and mail servers

The policy must list every host that accepts mail for the domain.

2

Mode

3

TLS reports

Senders email a daily JSON summary of delivery successes and failures to this address.

Hosting the policy file

This is where most setups fail. The file must be served at exactly this address, over HTTPS, with a valid certificate and no redirect:

https://mta-sts.mxb-canary.global.inbound.cf-emailsecurity.net/.well-known/mta-sts.txt

  1. Create a small static site on GitHub Pages, Cloudflare Pages or Netlify that contains only .well-known/mta-sts.txt. On GitHub Pages add an empty .nojekyll file so the dot-folder is served.
  2. Add mta-sts.mxb-canary.global.inbound.cf-emailsecurity.net as a custom domain there and create the CNAME it asks for. The host issues the certificate.
  3. Open the address above in a browser and confirm the file loads without a redirect.
  4. Publish the TLS-RPT record, then the _mta-sts record last.

Change the id every time you edit the policy. Senders only refetch the file when the id changes; otherwise they keep the cached copy until max_age runs out.

Hosting the policy file

This is the step people get stuck on. The policy must be reachable at https://mta-sts.yourdomain/.well-known/mta-sts.txt with a valid certificate. The simplest way is a static host: create a small site on GitHub Pages, Cloudflare Pages, Netlify or a Cloudflare Worker containing only that file, then point a CNAME from mta-sts.yourdomain at it and let the host issue the certificate.

Publish in this order: the policy file first, then the TLS-RPT record, then the _mta-sts TXT record last. Senders look for the TXT record first, so publishing it before the file exists produces fetch errors.

Questions

What max_age should I use?

604800 (one week) is a good default. Google suggests one to two weeks while testing. Longer values protect better once the policy is stable, up to a maximum of one year.

Do I need the trailing line breaks to be CRLF?

RFC 8461 specifies CRLF line endings. Most senders accept plain LF too, but the downloaded file uses CRLF to be safe.

What happens when I change mail providers?

Add the new MX hosts to the policy and change the id before you switch MX records. Remove the old hosts after the switch.