When someone sends email to your domain, their mail server connects to yours and hands the message over. Most of the time that connection is encrypted. MTA-STS is how you make sure it stays that way, even when someone on the network is trying to read your mail.
The weak spot in server-to-server email
Mail servers talk to each other over SMTP, a protocol that dates from the early 1980s and was designed without encryption. Encryption was added later through a command called STARTTLS. The receiving server says it supports TLS, and the sending server upgrades the connection before sending the message.
The catch is that this upgrade is opportunistic. If the receiving server doesn't offer STARTTLS, or the TLS handshake fails, most sending servers deliver the message in plain text anyway rather than bounce it. Most also accept any certificate, including an expired or self-signed one, because refusing would mean lost mail.
That leaves an opening. An attacker who sits between two mail servers can remove the STARTTLS offer from the conversation, and the sender falls back to plain text without anyone noticing. The attacker can also present their own certificate and read the traffic as it passes through. The Electronic Frontier Foundation has documented internet providers doing exactly this to their customers' mail traffic.
What MTA-STS does
MTA-STS (Mail Transfer Agent Strict Transport Security, defined in RFC 8461) lets a domain publish a rule for senders. The rule says: Only deliver to my mail servers over TLS, and only if the certificate is valid and matches the server's name. A sender that supports MTA-STS reads the rule, caches it, and follows it on every delivery until it expires.
Google and Microsoft both check MTA-STS policies when delivering mail, so turning it on protects messages coming from the largest senders.
How it works
MTA-STS has two parts: a DNS record that says a policy exists, and the policy itself, served over HTTPS.
1. The DNS record
A TXT record at _mta-sts.example.com tells senders the domain has a policy:
_mta-sts.example.com. TXT "v=STSv1; id=20261116"
The id is any short string. Senders compare it with the one they cached, and when it changes they fetch the policy again. That's how a domain signals that its policy has been updated.
2. The policy file
The policy lives at a fixed address on a fixed host name: https://mta-sts.example.com/.well-known/mta-sts.txt. It has to be served over HTTPS with a valid certificate, which is what stops an attacker from swapping in a policy of their own. A policy looks like this:
version: STSv1
mode: testing
mx: mail.example.com
max_age: 86400
- mode is the important line. It has three settings:
enforce: Senders must use TLS with a valid certificate, or they don't deliver.testing: Senders deliver as usual but report any TLS problems they find.none: The domain is withdrawing its policy, and senders should stop applying it.
- mx lists the mail server names senders may deliver to. Each server's certificate must match one of these names.
- max_age is how long, in seconds, a sender may keep using the policy before checking again. 86400 is one day.
Senders trust a policy the first time they fetch it, then rely on their cached copy. An attacker who wasn't there for that first fetch can't remove the policy afterwards, which is why a longer max_age gives stronger protection once a domain is in enforce mode.
TLS reports: seeing what senders see
MTA-STS has a companion standard, SMTP TLS Reporting (RFC 8460). It asks senders to send a daily summary of their connections to your domain: how many used TLS successfully, and which failed and why. You publish where the reports should go in another TXT record:
_smtp._tls.example.com. TXT "v=TLSRPTv1; rua=mailto:tls-reports@example.com"
These reports are what make testing mode useful. They show whether turning on enforce would block any real mail before you do it.
MTA-STS and DANE
DANE is another way to secure mail delivery. It publishes the mail server's certificate details in DNS and relies on DNSSEC to prove those records are genuine. It avoids MTA-STS's trust-on-first-use gap, but it only works if both the domain and its mail servers use DNSSEC, which many DNS providers and registrars still don't make easy.
MTA-STS needs only ordinary DNS and an HTTPS server. The two can be used together.
How HugeMX sets it up for you
Running MTA-STS yourself means hosting a web server on mta-sts.yourdomain.com, keeping its certificate renewed, and editing DNS every time the policy changes. HugeMX does that part for you.
- We host the policy file for your domain and keep its HTTPS certificate issued and renewed.
- You add three DNS records once. They point at HugeMX, so when your policy changes, nothing in your DNS has to.
- Your dashboard checks the records and tells you when they're in place.
- TLS reports for your domain come to us, so we can spot delivery problems.
These are the three records to add at your DNS provider, with your own domain in place of example.com:
| Name | Type | Points to |
|---|---|---|
mta-sts.example.com | CNAME | mta-sts.hugemx.com |
_mta-sts.example.com | CNAME | _mta-sts.hugemx.com |
_smtp._tls.example.com | CNAME | _smtp._tls.hugemx.com |
Some DNS providers want only the first part of the name, such as mta-sts or _mta-sts, and add your domain themselves.
Why every domain starts in testing mode
Once your records check out, your domain starts in testing mode. Senders keep delivering your mail exactly as before and send us reports about the TLS connections they make. Nothing gets blocked in testing mode.
When the reports show senders connecting over TLS without problems, we move your domain to enforce mode. From then on, senders that support MTA-STS won't deliver your mail over a connection that isn't encrypted and verified.
Enforce mode needs your MX records to use the mail server names listed in the policy. Senders that enforce the policy skip any mail server it doesn't list, and they refuse a listed server whose certificate doesn't match its name. Your dashboard checks both for you and shows when your domain is ready.
Set up MTA-STS on your domain
Already a customer? Open your domain in the dashboard to find the records and check them. New to HugeMX? Hosted MTA-STS comes with our email hosting.
Go to your domains See plansFurther reading: RFC 8461, SMTP MTA Strict Transport Security and RFC 8460, SMTP TLS Reporting.