Suped

What is the purpose of the MTA-STS TXT record?

MTA-STS, which stands for Mail Transfer Agent Strict Transport Security, is an important standard designed to bolster email security. At its core, it ensures that emails are transmitted between mail servers over an encrypted connection, specifically using Transport Layer Security (TLS). This protects against man-in-the-middle (MITM) attacks, where an attacker could intercept, read, or alter emails in transit. The official IETF specification describes it as a mechanism for mail providers to declare their ability to receive TLS-secured connections. But how does a sending server know that a receiving domain even supports MTA-STS? That's where the MTA-STS TXT record comes in.

www.mailmodo.com logo
Mailmodo says:
Visit website
MTA-STS is another email security protocol that is designed to prevent issues such as man-in-the-middle (MITM) attacks and address longstanding vulnerabilities...

The MTA-STS TXT record is the essential first step in the entire process. It's a specific type of DNS record that acts as a signal to the outside world. When a sending mail server attempts to deliver an email, it first performs a DNS lookup to see if the recipient's domain has published an MTA-STS TXT record. This record essentially announces, “Yes, I support MTA-STS, and you should follow my security policy.”

www.a6n.co.uk logo
Artic6 Blog says:
Visit website
When a sending mail server tries to deliver a message, it checks for the `_mta-sts` TXT record in the recipient domain's DNS.
Suped DMARC monitor
Free forever, no credit card required
Get started for free
Trusted by teams securing millions of inboxes
Company logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logo

How the MTA-STS process works

Once a sending server discovers the MTA-STS TXT record, a specific sequence of events is triggered to ensure a secure connection. The TXT record itself doesn't contain the full security policy; instead, it points the sending server in the right direction to find it. The entire process is a clever combination of DNS for discovery and HTTPS for secure policy delivery.

  • A sending server looks for a TXT record at the subdomain _mta-sts.yourdomain.com.
  • If found, this record confirms that your domain uses MTA-STS and provides a unique policy ID.
  • The sending server then constructs a URL to fetch the full policy file from a web server: https://mta-sts.yourdomain.com/.well-known/mta-sts.txt.
  • This policy file, retrieved securely over HTTPS, lists your designated mail servers (your MX records) and the enforcement mode (e.g., enforce or testing).
  • The server then verifies that the recipient's mail server has a valid TLS certificate and its hostname matches one listed in the policy.
  • If all checks pass, the email is delivered over an encrypted TLS connection. If they fail and the policy is set to enforce, the delivery is aborted.
www.uriports.com logo
URIports Blog says:
Visit website
MTA -STS is a mechanism that instructs an SMTP server that the communication with the other SMTP server MUST be encrypted.

The structure of an MTA-STS TXT record

The MTA-STS TXT record itself is quite simple and contains two key-value pairs. It's located at the _mta-sts subdomain of your domain. A typical record looks something like this: v=STSv1; id=2024090101;

  • v=STSv1: This tag indicates the version of the MTA-STS protocol being used. Currently, STSv1 is the only version.
  • id=...: This is a unique string that serves as an ID for your current policy. It can be a timestamp, a version number, or any other unique sequence of characters. Its primary purpose is to signal policy changes. When you update your mta-sts.txt policy file, you must also update this id in your DNS record. This tells sending servers that their cached version of your policy is outdated and they need to fetch the new one.

Why use DNS and HTTPS together?

A common question is why the entire policy isn't just placed in the DNS record. Why the extra step of fetching a file over HTTPS? The answer comes down to security and integrity. While DNS is excellent for discovery, it's not inherently secure against certain attacks like DNS spoofing unless DNSSEC is used, which has its own adoption challenges.

developers.cloudflare.com logo
Cloudflare Docs says:
Visit website
This file defines the mail servers in the domain that use MTA-STS. The reason why HTTPS is used here instead of DNS is because not everyone...

By requiring the policy to be fetched over an HTTPS connection, MTA-STS leverages the web's public key infrastructure (PKI). The sending server can validate the SSL/TLS certificate of the web server hosting the policy file, ensuring it's communicating with the authentic server for that domain. This prevents an attacker from injecting a fake policy through a DNS attack, which might otherwise trick a sending server into downgrading the connection or sending email to a malicious server. It adds a crucial layer of verification that DNS alone doesn't provide as reliably.

Putting it all together

In summary, the MTA-STS TXT record is the linchpin of the whole system. It doesn't hold the security rules itself, but it's the public declaration that initiates the secure email delivery process. By simply existing, it tells other mail servers that you enforce encrypted connections, and by containing a version and ID tag, it directs them to find and use your up-to-date security policy. It's a small but powerful piece of your domain's DNS that plays a massive role in preventing email interception and protecting your communication channels.

Start improving your email deliverability today

Get started