How to keep spam out of the inbox in Exchange Online

Set the spam action to Move message to Junk Email folder (or quarantine) and the high-confidence spam action to quarantine in every inbound policy.

Every Microsoft 365 security check · Threat Protection · NL-EXO-130

What this check looks at

Checks no inbound anti-spam policy delivers spam or high-confidence spam to the inbox (only marked with a header or a changed subject): it goes to the Junk Email folder or to quarantine.

The inbound anti-spam policy also says what happens to spam and to high-confidence spam. Moving it to the Junk Email folder or to quarantine keeps it out of the way; adding a header or a word to the subject delivers it to the inbox, where it reads like any other email.

The check reads every inbound anti-spam policy and passes when no policy leaves spam or high-confidence spam in the inbox. It fails naming each policy that does, and reports not checked when the actions were not returned.

Why it matters

Spam left in the inbox with only a tag in its subject reads like any other email, and the scams that slip into it arrive next to genuine mail. Moving it to Junk or quarantine is the filter doing its job.

An inbox full of tagged spam teaches people to skim and click. The scams and fake invoices that slip through the filter arrive between the spam, and a busy person is more likely to open one when everything around it looks the same.

Moving spam to Junk Email is Microsoft’s default and its recommended setting, so a policy that delivers spam to the inbox was usually changed on purpose, often years ago, to work around one sender. That sender is better handled with the Tenant Allow/Block List.

How to fix it

Where: Microsoft Defender portal → Email & collaboration → Policies & rules → Threat policies → Anti-spam

Before you start

  • Tell people that spam now goes to Junk Email, and to look there before asking for a missing message.

Step by step

  1. See each policy’s actions. Run Get-HostedContentFilterPolicy | Format-Table Name, SpamAction, HighConfidenceSpamAction to list what each inbound anti-spam policy does with spam.
  2. Find out why it was changed. Ask whether a sender’s mail was being lost when the action was changed. If so, add that sender to the Tenant Allow/Block List instead, so the rest of the spam can go back to Junk.
  3. Move spam out of the inbox. In the Defender portal, Anti-spam, open each inbound policy, choose Actions and set Spam to Move message to Junk Email folder and High confidence spam to Quarantine message (or Junk Email).
  4. Tell people where to look. Let staff know spam now goes to their Junk Email folder, and that a message they were expecting may be there before they ask the helpdesk.
  5. Confirm the setting. Run the command from the first step again and check every policy shows MoveToJmf or Quarantine. The next assessment passes.

With PowerShell

Get-HostedContentFilterPolicy | Set-HostedContentFilterPolicy -SpamAction MoveToJmf -HighConfidenceSpamAction Quarantine

What users will notice

Spam goes to the Junk Email folder (high-confidence spam to quarantine) instead of the inbox with a tag.

How to confirm it worked

Get-HostedContentFilterPolicy | Format-Table Name, SpamAction, HighConfidenceSpamAction shows MoveToJmf or Quarantine for every policy.

Frameworks and controls

This check maps to controls in 12 frameworks. Passing it is evidence that the setting is in place, not a certification against any of them.

The frameworks and controls NL-EXO-130 maps to
FrameworkControl
NCSC CAFB4.b Secure configuration
DSPTStandard 9: IT protection
NIS2Art. 21(2)(e) Security in acquisition, development and maintenance, including vulnerability handling
Zero TrustApplications
SOC 2CC6.8 Preventing or detecting unauthorised or malicious software
PCI DSS 4.0.15.4.1 Personnel are protected against phishing attacks
NIST SP 800-1713.14.2 Provide protection from malicious code
CMMC Level 2SI.L2-3.14.2 Malicious Code Protection
ISO 27001:2022A.8.7 Protection against malware
CIS Controls v8.19.7 Deploy and maintain email server anti-malware protections (IG3)
NIST CSF 2.0PR.PS-01: Configuration management practices are established and applied
NCSC 10 StepsArchitecture and configuration

The framework mappings were last checked against the published standards in October 2026.

Microsoft’s documentation

The full Microsoft 365 security checklist, worst first

ConfigCheckup

Check this in every tenant.

ConfigCheckup runs this check on every tenant you connect and gives you a step-by-step fix guide. The next assessment confirms the fix.

14 days of daily monitoring and alerts, every finding with its fix guide, and reports on up to 3 tenants, from your first connected tenant. No card. Then choose the plan that fits.Where this check fits: Microsoft 365 security assessment for MSPs