Suped

What is the purpose of the 'id' tag in an MTA-STS policy TXT record?

Mail Transfer Agent Strict Transport Security (MTA-STS) is a critical email security standard that helps prevent man-in-the-middle attacks by ensuring emails are transmitted over an encrypted TLS connection. It acts as a declaration from your domain that you are able to receive secure SMTP connections. A core part of implementing MTA-STS involves publishing a specific DNS TXT record, and within that record lies a small but vital component: the 'id' tag.

At first glance, the 'id' tag might seem like a simple label, but its role is far more active. It's the key mechanism that allows sending mail servers to know when your security policy has changed. Let's break down exactly what it does and why it's so important to manage correctly.

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

What is an MTA-STS TXT record?

Before we dive into the 'id' tag, it's helpful to understand the record it lives in. For MTA-STS to work, you must create a TXT record at the subdomain _mta-sts.yourdomain.com. This record doesn't contain the policy itself; instead, it signals to the world that a policy exists and provides a version identifier for it. A typical MTA-STS TXT record looks like this:

v=STSv1; id=20240520120001;

vand3rlinden.com logo
VAND3RLINDEN says:
Visit website
This TXT record is placed at _mta-sts.example.com and signals the presence of an MTA-STS policy. _mta-sts.example.com IN TXT "v=STSv1; id= ..."

This record has two key-value pairs:

  • v=STSv1: This specifies the version of the MTA-STS protocol. Currently, 'STSv1' is the only version.
  • id=...: This is the policy identifier, which is the main subject of this article.

The purpose of the 'id' tag

The primary purpose of the 'id' tag is to signal policy updates. Think of it as a version number for your MTA-STS policy. When a remote mail server wants to send an email to your domain, it first looks up this TXT record. It then fetches the full policy file, which is a simple text file hosted on your web server at a well-known URL. The server then caches this policy for a set period.

www.uriports.com logo
URIports Blog says:
Visit website
The first DNS record to add is a "_mta-sts" TXT record containing the version and an id. ... The id is used to track policy updates.

The next time that server needs to send you an email, it will check the 'id' in your DNS record again.

  • If the 'id' matches the one it has cached, it knows your policy hasn't changed and continues using the cached version.
  • If the 'id' is different, the server knows the policy has been updated. It will then discard its old cached policy and fetch the new one from your web server.
www.ericlight.com logo
Such geek. Wow. says:
Visit website
When you do this, make sure you update the ID in your TXT Record! This is how sending mail servers know that there has been a policy update.

Why you must update the 'id'

This update mechanism is why managing the 'id' tag is crucial. If you make a change to your MTA-STS policy file, such as adding a new MX record or changing the policy mode from testing to enforce, you must also update the 'id' in your DNS TXT record.

If you fail to update the 'id', sending servers will have no way of knowing your policy has changed. They will continue to use their old, cached version, which could lead to email delivery failures if, for example, your old policy doesn't include your new mail servers. The 'id' can be any sequence of up to 32 alphanumeric characters. A common and effective best practice is to use a timestamp like YYYYMMDDHHMMSS or a simple sequential number. This makes it easy to generate a new, unique 'id' every time you update your policy.

In summary, the 'id' tag in an MTA-STS TXT record is the trigger that informs the internet of changes to your email security policy. It is a simple but essential component for the correct and reliable operation of MTA-STS, ensuring that all sending servers are always operating with your domain's most current and accurate security rules.

Start improving your email deliverability today

Get started