Suped

What HTTP status code should an MTA-STS policy file return on success?

Matthew Whittaker profile picture
Matthew Whittaker
Co-founder & CTO, Suped
Published 9 Jan 2025
Updated 11 Oct 2025
6 min read
Secure email represented by an envelope with digital locks and a green checkmark.
When implementing Mail Transfer Agent Strict Transport Security (MTA-STS), one of the fundamental requirements is serving the policy file correctly. This policy file, located at a specific HTTPS endpoint on your domain, dictates how receiving mail servers should validate connections to your Mail eXchangers (MX records). Ensuring this file is accessible and correctly communicated is crucial for robust email security, preventing downgrade attacks and man-in-the-middle attacks.
The HTTP status code returned when a sending server (client) attempts to fetch your MTA-STS policy is a direct signal of success or failure. This code tells the client whether it found the policy, if there were any server-side issues, or if the resource simply doesn't exist. Getting this detail right is paramount for your MTA-STS deployment to function as intended.
For an MTA-STS policy file to be successfully retrieved and applied, it must return an HTTP 200 OK status code. This code indicates that the request was successful and that the client has received the expected policy content. Any other status code will lead to the sending server either ignoring the policy, treating it as non-existent, or temporarily failing the delivery based on the error type.

The HTTP 200 OK status code

Understanding the MTA-STS policy retrieval process

MTA-STS policies are served over HTTPS, specifically from a predefined path: https://mta-sts.yourdomain.com/.well-known/mta-sts.txt. A sending mail server (client) looks up a TXT record for _mta-sts.yourdomain.com to determine if MTA-STS is enabled for your domain. If it is, the client then attempts to fetch the policy file from the URL provided. You can learn more about how MTA-STS uses HTTPS for policy retrieval in our detailed guide.
The success of this fetching process hinges entirely on the HTTP status code returned by the web server hosting the policy file. The policy itself is a plain text file, but it must be served correctly with the appropriate Content-Type header set to text/plain or application/json. Incorrect content type or status code can effectively render your MTA-STS policy invisible or unusable to sending mail servers.

Example MTA-STS policy file content

mta-sts.txtplaintext
version: STSv1 mode: enforce mx: mail.yourdomain.com mx: *.yourdomain.com max_age: 86400
This policy, when served with an HTTP 200 OK, instructs sending mail servers on how to securely connect to your domain. The specific format of the MTA-STS policy file is critical for correct interpretation.

Why other codes are not appropriate

An HTTP 200 OK status code is the universal signal that a web server has successfully processed a client's request. In the context of MTA-STS, it means the sending mail server requested the policy file and received it without any issues. This allows the client to then parse the policy directives, such as the required TLS version, MX hostnames, and the policy's maximum age.
Without a 200 OK response, the policy cannot be properly evaluated, which undermines the security benefits of MTA-STS. Sending mail servers are programmed to expect this specific response to confirm the validity and availability of the policy. A detailed implementation guide, such as the one by Matthew Davidson, often confirms this requirement.

Success: HTTP 200 OK

  1. Policy retrieval: The sending server successfully fetches the MTA-STS policy file.
  2. Security enforcement: The policy directives (TLS, MX records) are applied, ensuring encrypted communication.
  3. Trust established: Sending mail servers can trust the connection, reducing risks of interception.

Failure: Other HTTP codes

  1. Policy ignored: Most servers will treat the absence of a 200 OK as if no policy exists.
  2. Fallback to insecure: Mail may be sent without TLS or with opportunistic TLS, compromising security.
  3. Deliverability impact: Some strict sending servers might refuse delivery if MTA-STS fails.

Monitoring and ensuring MTA-STS effectiveness

Any HTTP status code other than 200 OK will typically be interpreted by the sending mail transfer agent (MTA) as a failure to retrieve the MTA-STS policy. For instance, a 404 Not Found error means the server could not locate the policy file at the expected path. In such cases, the sending MTA will usually revert to its default behavior, which might involve opportunistic TLS or even sending without encryption, depending on its configuration.
Similarly, server-side errors, such as 500 Internal Server Error or 503 Service Unavailable, will also prevent the policy from being used. These indicate that while the server was reached, it encountered an issue preventing it from fulfilling the request. The MTA-STS specification is clear that only a 200 OK response ensures the policy is parsed and enforced. Mailhardener outlines these requirements in their knowledge base.
Security failure indicated by a broken chain link and a red crossed-out lock.
It is important to configure your web server to deliver the MTA-STS policy file reliably. This includes ensuring correct file placement, proper HTTPS certificate setup, and a web server configuration that explicitly returns HTTP 200 OK for requests to /.well-known/mta-sts.txt. Incorrect configurations can leave your email communications vulnerable, defeating the purpose of MTA-STS.

Conclusion

Regularly verifying that your MTA-STS policy file returns an HTTP 200 OK status is a crucial aspect of maintaining your email security posture. Automated monitoring can alert you to any issues that might arise, such as server misconfigurations, expired certificates, or DNS problems affecting the policy lookup process.
For comprehensive oversight of your email authentication protocols, including MTA-STS, DMARC, SPF, and DKIM, a unified monitoring platform is invaluable. Such tools allow you to track policy fetching, identify potential vulnerabilities, and ensure that your email ecosystem remains secure and compliant. You can also detect and verify MTA-STS policy changes to proactively address issues.
Suped offers a robust DMARC monitoring solution that provides AI-powered recommendations to resolve issues, real-time alerts for critical events, and a unified dashboard for managing DMARC, SPF, and DKIM. Our platform also includes SPF flattening capabilities and is designed with an MSP and multi-tenancy dashboard, making it ideal for managing multiple domains efficiently. With our generous free plan, you can begin securing your email communications today.

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
    What HTTP status code should an MTA-STS policy file return on success? - MTA-STS - Email authentication - Knowledge base - Suped