Suped

How to detect and verify MTA-STS policy changes and locations?

Michael Ko profile picture
Michael Ko
Co-founder & CEO, Suped
Published 21 Apr 2025
Updated 19 Aug 2025
7 min read
MTA-STS, or Mail Transfer Agent Strict Transport Security, is a vital security standard designed to enhance the security of email transmissions. It ensures that mail servers always use encrypted connections (TLS) when exchanging emails, helping to prevent man-in-the-middle attacks and opportunistic encryption failures.
For email administrators and deliverability professionals, understanding how to detect and verify MTA-STS policy changes and their locations is crucial. Misconfigurations or unverified changes can lead to email delivery failures, loss of encryption, and potential security vulnerabilities. Keeping track of your MTA-STS setup is an ongoing task that directly impacts your email security posture and deliverability.
In this guide, I'll walk through the process of detecting policy updates, verifying their correct configuration, and identifying common pitfalls. Proper management of MTA-STS ensures secure and reliable email communication for your domain.
Suped DMARC monitoring
Free forever, no credit card required
Learn more
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 logo

How MTA-STS policies are published and discovered

MTA-STS operates through a combination of DNS records and a policy file hosted on a web server. To detect a policy change, you must first understand how these components interact. A sending mail server (MTA) queries the DNS for a specific TXT record associated with the receiving domain.
This DNS TXT record is typically named _mta-sts.yourdomain.com and contains a version number (v=STSv1) and a policy ID (id=). The id value is crucial for detecting changes, as any modification to the policy file requires updating this ID to signal to sending MTAs that a new policy is available. This ensures that a cached, outdated policy is replaced with the most current one.
After discovering the TXT record, the sending MTA fetches the actual policy file via HTTPS from a fixed location: https://mta-sts.yourdomain.com/.well-known/mta-sts.txt. This file contains directives such as mode (enforce, testing, none), a list of allowed MX records, and max_age (how long the policy can be cached). For a comprehensive understanding of the specification, consult RFC 8461 for MTA-STS.
Example MTA-STS DNS TXT Record and Policy FileDNS
_mta-sts.yourdomain.com. IN TXT "v=STSv1; id=202407251030Z;" # https://mta-sts.yourdomain.com/.well-known/mta-sts.txt version: STSv1 mode: enforce mx: mail.yourdomain.com mx: mail2.yourdomain.com max_age: 86400

Detecting MTA-STS policy updates

The primary way to detect an MTA-STS policy change is by monitoring the id value in your _mta-sts DNS TXT record. When the content of your MTA-STS policy file changes, the id value must be updated to a new, unique string. This update signals to sending MTAs that they need to re-fetch the policy, ensuring they operate with the most current instructions.
Manual checks using command-line tools like dig or online DNS lookup services can help you periodically check the id value. However, for continuous monitoring, especially for larger organizations or those with frequent changes, automated systems are highly recommended. These systems can alert you immediately when DNS records change, indicating a potential MTA-STS policy update (or an unauthorized change).
Additionally, if you receive MTA-STS TLS reports (TLS-RPT reports), these can provide invaluable insight into how sending MTAs are interacting with your policy. These reports will highlight any failures or issues related to policy fetching or TLS negotiation, indirectly signaling whether your new policy is being correctly applied or if there are unexpected issues.

Detection Method

Pros

Cons

Manual DNS Lookup
Simple for occasional checks, no tools needed besides standard CLI or web interface.
Time-consuming and prone to human error, not suitable for continuous monitoring.
Automated DNS Monitoring
Provides real-time alerts on id changes, ensures prompt detection of updates.
Requires a dedicated monitoring service or self-hosted solution.
TLS-RPT Reports
Offers insights into policy application failures from external MTAs.
Reactive, as it reports on issues after they occur, not proactive change detection.

The value of TLS-RPT reports

google.com logoGoogle and other mail providers offer TLS reporting which is a critical feedback mechanism for MTA-STS. These reports provide aggregated data on successful and failed TLS connections, including reasons for failures. Regularly reviewing these reports is essential for identifying if a new MTA-STS policy is causing unexpected issues or if external mail servers are struggling to comply. It's an indispensable tool for diagnosing hidden problems that might not be immediately apparent from simple policy checks.

Verifying MTA-STS policy locations and content

Once you detect a policy change, the next step is to verify its correct implementation and location. There are two main components to verify: the DNS TXT record and the MTA-STS policy file itself.
To verify the DNS TXT record, you can use a command-line tool. Open your terminal or command prompt and use dig to query the _mta-sts record for your domain. Ensure the id value matches what you expect. If you encounter issues, it might be related to other email authentication setup that could lead to broader deliverability problems. After the DNS check, verify the policy file itself. Use curl or a web browser to access https://mta-sts.yourdomain.com/.well-known/mta-sts.txt. Check the content for correct syntax, the presence of your MX records, and the desired mode (e.g., enforce or testing). Ensure the HTTPS connection is secure and the certificate is valid, as sending MTAs will reject insecure connections to the policy file.
It's also important to consider the max_age value in your policy. A very long max_age (e.g., 31536000 seconds for a year) can make it difficult to roll back changes quickly if issues arise. Conversely, a too-short max_age could lead to excessive policy fetching. A balance needs to be struck, typically around a few days to a week during initial deployment or after significant changes, then extended once stability is confirmed.

Manual verification

  1. DNS check: Use dig TXT _mta-sts.yourdomain.com to confirm the presence and id value of your MTA-STS TXT record.
  2. Policy file check: Access https://mta-sts.yourdomain.com/.well-known/mta-sts.txt in a browser or with curl. Verify content, syntax, and HTTPS certificate.

Pros

  1. No external tools: Can be done with standard operating system commands and a web browser.
  2. Direct inspection: Allows for granular examination of the raw policy data.

Cons

  1. Time-consuming: Requires manual execution for each domain or after every change.
  2. Error-prone: Easy to miss subtle misconfigurations or certificate issues.
  3. Limited scope: Doesn't provide ongoing monitoring or historical data.

Automated verification

  1. Specialized tools: Use online MTA-STS validators or platforms for comprehensive checks.
  2. Continuous monitoring: Implement services that regularly check your MTA-STS records and policies.

Pros

  1. Efficiency: Automates checks, saving time and reducing manual effort.
  2. Accuracy: Identifies complex issues like certificate trust paths or misconfigured MX records.
  3. Proactive alerts: Notifies you immediately of problems, enabling rapid response.

Common pitfalls and troubleshooting MTA-STS issues

Despite careful planning, MTA-STS configurations can encounter issues. Common pitfalls include incorrect DNS TXT record formatting, an inaccessible policy file (e.g., due to firewall rules or web server misconfiguration), or invalid HTTPS certificates on the mta-sts subdomain. If your policy file is not reachable via HTTPS with a valid certificate, sending MTAs will not honor your MTA-STS policy, potentially downgrading connections to unencrypted or failing delivery.
Another common issue arises from setting an excessively long max_age in your policy. While a longer max_age reduces policy fetches, it also means that if you need to make an urgent change or roll back an erroneous policy, it will take much longer for external MTAs to pick up the update. This can lead to prolonged email delivery issues or security risks. To learn more about this, you can refer to discussions on the risks of a long max_age.
Leveraging DMARC reports alongside TLS-RPT can help diagnose broader email authentication and delivery problems that might indirectly affect or be affected by MTA-STS. These reports provide visibility into authentication failures, including those related to secure transport, helping you pinpoint the root cause of deliverability issues.

Common MTA-STS Configuration Errors

microsoft.com logoMicrosoft and other mail providers may log various errors if your MTA-STS setup is incorrect. It's vital to monitor your outbound mail logs for messages indicating failures to retrieve or apply MTA-STS policies. A common log message indicates inability to resolve the policy host or fetch the policy file due to HTTPS issues.
Example MTA-STS Error Log EntryText
status: failure reason: The MTA-STS policy could not be retrieved due to an SSL/TLS error. Failed to verify certificate chain.
This kind of error usually points to a problem with the SSL/TLS certificate on the mta-sts.yourdomain.com subdomain. It could be an expired certificate, a mismatch in the common name, or an incomplete certificate chain. Timely detection of these issues is crucial to maintain email deliverability and security.

Ensuring secure email flows with MTA-STS

MTA-STS is a powerful tool for enforcing secure email transport, but it requires diligent management. Successfully detecting and verifying policy changes means maintaining a keen eye on your DNS records, particularly the id parameter, and regularly checking the accessibility and content of your MTA-STS policy file.
By proactively monitoring for changes and leveraging tools like TLS-RPT reports, you can ensure your MTA-STS implementation continues to function correctly, safeguarding your email communications against potential threats and ensuring optimal deliverability.

Views from the trenches

Best practices
Implement automated DNS monitoring for _mta-sts TXT records to detect ID changes immediately.
Review TLS-RPT reports regularly to identify any policy application failures or unexpected behavior.
Start with a 'testing' mode policy and gradually transition to 'enforce' once stability is confirmed.
Common pitfalls
Forgetting to update the 'id' value in the DNS TXT record when the policy file changes, leading to outdated policies being cached.
Hosting the MTA-STS policy file on an insecure HTTP connection or with an invalid SSL certificate, making it unretrievable.
Setting an excessively long max_age, which delays the propagation of critical policy updates or rollbacks.
Expert tips
Use a version control system for your MTA-STS policy file to track changes and simplify rollbacks.
Test your MTA-STS policy from various geographic locations to ensure global accessibility.
Consider using a CDN or cloud storage for your MTA-STS policy file to ensure high availability and proper SSL.
Marketer view
Marketer from Email Geeks says they detected Yahoo.com moved to an enforce MTA-STS policy by observing a dramatic increase in enforce policy logs.
2019-05-30 - Email Geeks
Expert view
Expert from Email Geeks says that the MTA-STS policy is stored in a fixed location like https://mta-sts.yahoo.com/.well-known/mta-sts.txt, not directly in the TXT record.
2019-05-30 - Email Geeks

Frequently asked questions

DMARC monitoring

Start monitoring your DMARC reports today

Suped DMARC platform dashboard

What you'll get with Suped

Real-time DMARC report monitoring and analysis
Automated alerts for authentication failures
Clear recommendations to improve email deliverability
Protection against phishing and domain spoofing