Contact us

Product

MTA-STS: enforcing TLS for email delivered to your domain

Most email already travels over encrypted connections, but nothing stops an attacker quietly stripping that encryption away. MTA-STS lets your domain insist on it, and the NCSC includes it in its email security guidance for UK organisations.

  • We reply by email
  • Forever Systems, part of Forever Group

In short

MTA-STS (SMTP MTA Strict Transport Security, RFC 8461) lets your domain tell other mail servers to deliver to you only over TLS 1.2 or later with a valid, matching certificate. You publish a TXT record at _mta-sts and a policy file on an HTTPS web server, start in testing mode with TLS-RPT reports, then switch to enforce.

Get a quote for MTA-STS

Tell us roughly how many users or sites you have and we will reply by email with options and a quote.

Contact us

What problem MTA-STS solves

Mail servers talk to each other over SMTP, which was designed to accept plain-text connections. Most servers try to upgrade to TLS, but if that fails they usually send the message anyway, unencrypted. That leaves room for a person-in-the-middle to block the upgrade, or to redirect mail to a server they control, and read messages in transit.

The NCSC describes the objectives of MTA-STS as making it harder for an attacker to get your mail sent somewhere else, and making sure TLS encryption is used rather than downgraded to clear text. It does this in two ways: your mail server names are published on a separate HTTPS web page, so an attacker cannot simply subvert your MX record, and an enforce policy tells sending servers not to deliver if a secure connection cannot be made.

Three limits are worth knowing:

  • It protects inbound mail only. Your MTA-STS policy protects mail sent to you; other domains' policies protect mail you send to them.
  • It needs the sender to support it. Servers that do not support MTA-STS carry on delivering as before, so it adds protection without breaking them.
  • It is not end-to-end encryption. Messages are encrypted between servers, not inside the mailbox. For sensitive content, see send secure email.

The three parts: TXT record, policy file and TLS-RPT

MTA-STS itself is a DNS record plus a policy file. The third piece, TLS reporting (TLS-RPT, RFC 8460), is a separate standard but the one that tells you whether MTA-STS is working. Shown for example.co.uk:

PartWhere it goesExample
MTA-STS policy discovery recordTXT record at _mta-sts.example.co.ukv=STSv1; id=20261101000000
MTA-STS policy filePlain text file at https://mta-sts.example.co.uk/.well-known/mta-sts.txt, served over HTTPS with a valid certificate for that subdomainSee the lines below
TLS-RPT recordTXT record at _smtp._tls.example.co.ukv=TLSRPTv1; rua=mailto:[email protected]

The policy file is a short text file, one key and value per line, with the version line first:

LineWhat it does
version: STSv1Required; must be the first line
mode: testingtesting, enforce or none (see below)
mx: mx1.example.co.ukOne line for each MX host that receives your mail; a wildcard can replace the leftmost label
max_age: 86400How long, in seconds, senders may cache the policy

The id in the TXT record can be any value of 1 to 32 letters and numbers, and it must change every time you change the policy, or senders keep using the cached version until max_age runs out. Google and Microsoft both suggest a date and time stamp so you can see when the policy last changed. Google says the policy file can be up to 64 KB, and each domain needs its own policy file hosted separately.

Not sure which option fits? Ask us

Tell us what you need and we will recommend the right option for your organisation, with a quote.

Contact us

Testing, enforce and none modes

The mode line controls what sending servers do when a secure connection fails:

ModeWhat MTA-STS-aware senders doWhen to use it
testingDeliver as normal, but send you TLS-RPT reports about any problemsFirst, while you check every MX host and certificate
enforceDo not deliver unless the connection uses TLS 1.2 or later and a valid certificate that matches the policyOnce the reports show no failures
noneTreat the domain as no longer using MTA-STSOnly when removing MTA-STS

How long to test depends on whose advice you follow. Google recommends two weeks in testing mode and a max_age of one to two weeks (604800 to 1209600 seconds) while testing. The NCSC is more cautious: it suggests a max_age of 24 hours (86400 seconds) in testing, at least a month of monitoring before you enforce, and a max_age of at least two weeks (1209600 seconds) once you do. The maximum is 31557600 seconds, about a year. A longer max_age in enforce mode protects you against attacks on DNS or on the policy hosting, which is the point of the standard.

How to set up MTA-STS

The steps are the same whichever mail platform you use:

  1. List every domain and subdomain that receives mail (every one with an MX record). Each needs its own configuration.
  2. Check each receiving mail server supports TLS 1.2 or later with a valid certificate that matches its MX name. Cloud services such as Exchange Online and Gmail handle this for you; your own servers need a reliable certificate renewal process.
  3. Set up TLS reporting first. Create a mailbox or reporting tool for TLS-RPT and publish the _smtp._tls record. Google recommends adding TLS reporting before turning on MTA-STS.
  4. Host the policy file in testing mode at https://mta-sts.yourdomain/.well-known/mta-sts.txt, with a valid certificate for the mta-sts subdomain.
  5. Publish the _mta-sts TXT record with a new id.
  6. Read the reports for failed connections, missing MX entries and certificate problems, and fix each one.
  7. Switch the policy to enforce, raise max_age and change the id in the TXT record.

Raw TLS-RPT reports arrive as JSON, so a reporting tool makes them far easier to read. If a mail server's certificate ever expires while you are in enforce mode, MTA-STS-aware senders will stop delivering to it, so certificate monitoring is part of the job for anything you host yourself.

Is MTA-STS the right fit for you?

We will check it against your systems and requirements and recommend the right option.

Contact us

MTA-STS in Exchange Online

Microsoft supports MTA-STS in Exchange Online in both directions:

  • Outbound: Exchange Online checks the MTA-STS policy of every domain it sends to, with nothing for you to configure. If a recipient domain's enforce policy fails, the sender gets a non-delivery report with error 5.4.8 (the MX host is not in the policy) or 5.7.5 (the certificate failed validation). Mail sent through an outbound connector to a smart host is validated against the smart host's domain.
  • Inbound: if your MX record points directly at Exchange Online, Microsoft's own policy shows the values to use, with mx: *.mail.protection.outlook.com. Microsoft says the shared certificate and the rule that only one organisation can receive mail for a domain mean the wildcard does not weaken security, but warns that this wildcard is specific to Exchange Online: if other providers also receive mail for your domain, list their MX hosts too.
  • Hosting: Exchange Online cannot host the policy file for you. Microsoft documents hosting it with Azure Static Web Apps, its recommended method because a TLS certificate is provided automatically, or with Azure Functions.

If your MX record points at a secure email gateway in front of Microsoft 365, the policy must list the gateway's MX hosts, and Microsoft advises checking the gateway provider's requirements. Exchange Online also supports inbound SMTP DANE with DNSSEC, a separate standard that protects mail in transit using signed DNS records; our sister site explains DNSSEC if you are weighing it up.

MTA-STS with Google Workspace and Gmail

When Gmail sends to a domain with an enforce policy, Google says its messages comply with that policy. For mail sent to your Google Workspace domain, you set MTA-STS up yourself:

  • MX hosts: list the MX values in your DNS. Google's current single MX record is smtp.google.com; organisations that started before 2023 may still use the older aspmx values, which Google still supports.
  • DNS records: Google says to add the _mta-sts and _smtp._tls records at your domain host, not in the Admin console, and to turn on TLS reporting before MTA-STS.
  • Policy hosting: you host the mta-sts.txt file on your own HTTPS web server, or use a hosted service.
  • Checking: the Admin console's Security Health page shows whether MTA-STS and TLS reporting are set up correctly.
  • Reports: TLS reports can be emailed to a mailbox you create; delivery to a web server needs an API that Google Workspace does not provide.

Separately, Gmail's secure transport (TLS) compliance setting lets you require TLS for mail to or from specific domains, such as a key supplier. Our Gmail security settings guide covers it, and our Google Workspace email security hub covers the wider picture.

Managed MTA-STS

The DNS records are simple; hosting the policy file on a web server with a valid certificate, keeping it in step with your MX records and reading TLS reports is the part that takes effort. Two of the products we supply include it:

  • Valimail Pro includes MTA-STS alongside automated SPF, DKIM, DMARC, BIMI and continuous protection reporting, licensed per domain.
  • IRONSCALES DMARC includes hosted MTA-STS and TLS-RPT with its hosted DMARC, SPF and DKIM; which features sit in DMARC and which in DMARC Pro is confirmed at quote.

Both make sense if you are also working towards DMARC enforcement, which the NCSC puts in the same implementation plan. Our email authentication hub compares them with the other DMARC tools we supply.

How we help

Forever Systems can check every domain that receives mail, set up TLS reporting, arrange hosting for the policy file (for example through a hosted MTA-STS option), run testing mode while we review the reports with you, and move each domain to enforce when the reports are clean. We can do this alongside SPF, DKIM and DMARC work so the whole NCSC plan is covered. Pricing for any hosted option is confirmed at quote. Contact us to protect mail in transit to your domains.

How Forever Systems helps with email security

We are an independent UK IT and cyber security provider. We supply several email security platforms, so we can suggest what suits your mail system, your risks and your budget rather than pushing one product.

  • Start with what you have: we can review the protection already built into Microsoft 365 or Google Workspace before suggesting anything extra
  • Compare like for like: API-based protection, secure email gateways, encryption and DLP from the vendors we supply, explained in plain English
  • Get authentication right: we help you plan SPF, DKIM, DMARC and MTA-STS so genuine mail is delivered and spoofed mail is not
  • Deployment help: connecting a platform to Microsoft 365 or Google Workspace, mail routing changes and policy set-up, scoped at quote
  • People and backup too: security awareness training, Check Point Harmony Email & Collaboration and Sophos from our specialist sites

Tell us about your mail system and we will suggest options, with pricing confirmed at quote.

Frequently asked questions

What is MTA-STS?

MTA-STS (SMTP MTA Strict Transport Security) is an email standard, RFC 8461, that lets a domain tell sending mail servers to deliver to it only over TLS 1.2 or later with a valid certificate that matches a published list of mail servers. It stops attackers downgrading or redirecting mail in transit.

Does MTA-STS encrypt email?

It makes sure email is encrypted with TLS while it travels between mail servers, and refuses delivery if that fails in enforce mode. It does not encrypt messages inside the mailbox or end to end; for that you need message encryption.

What is the difference between MTA-STS and TLS-RPT?

MTA-STS sets the policy that sending servers must follow when delivering to you. TLS-RPT (RFC 8460) is a separate DNS record that asks those servers to send you daily reports about connection problems, so you can fix them before and after you enforce.

Does Exchange Online support MTA-STS?

Yes. Exchange Online automatically validates other domains' MTA-STS policies when sending. For inbound mail you can publish a policy with mx: *.mail.protection.outlook.com if your MX points to Exchange Online, but you must host the policy file yourself, for example with Azure Static Web Apps.

How long should MTA-STS stay in testing mode?

Google recommends two weeks; the NCSC recommends monitoring for at least a month before you enforce. Move to enforce only when your TLS reports show no failed connections.

Do I need MTA-STS if I have DMARC?

They do different jobs. DMARC stops others sending mail as your domain; MTA-STS protects mail sent to you from being intercepted or downgraded in transit. The NCSC recommends both.

Still have a question about MTA-STS?

Ask us and a member of our team will reply by email.

Contact us

Next step

Want help choosing an email security platform?

Tell Forever Systems what you need and we will come back to you by email with options and next steps.

  1. 1
    Tell us what you needA few lines is enough: your organisation, users or sites, and timescales.
  2. 2
    We read it and reply by emailWith options and clear next steps.
  3. 3
    You decideChoose the option that suits you and we take it from there.

Email Security UK is a website of Forever Systems, part of Forever Group. Vendor-independent. We supply and support several email security platforms, so we recommend what fits.

Send a quick enquiry

We reply by email.

About: MTA-STS

We only use these details to reply to your enquiry.

Talk to us about MTA-STS

We reply by email.

We only use these details to reply to your enquiry.
Talk to us aboutMTA-STS
Contact us