Library

Guides Quick Fixes Scripts Find a Guide

Tools

Error Decoder Assessment Baselines Free Tools Service status What's Changed

More

AI Certifications For MSPs Recommended Gear Field Kit FAQ About Contact Get Assessment

Block Automatic External Email Forwarding in Exchange Online

EntraReady Guides · Practical Microsoft 365 & Entra ID
Last reviewed:
Last verified against Microsoft Learn:

Automatic forwarding to outside addresses is a common way data leaves after an account is compromised: an attacker adds an Inbox rule, or an admin-level mailbox forward, and mail quietly copies out. Microsoft's Exchange documentation says automatic forwarding to external recipients makes your organization vulnerable to takeover attacks (Configure email forwarding (opens in a new tab)). The outbound spam policy is the main control.

Use it when: you're hardening a new tenant, responding to a business email compromise, or you aren't sure what Automatic - System-controlled means in your tenant.

Before you start

Know the three settings

Setting What it does
Automatic - System-controlled (default) Originally meant On. In 2021 it changed to mean Off for new organizations and for organizations not actively using it, but it can still mean On for some older organizations. Microsoft recommends picking On or Off explicitly instead.
On - Forwarding is enabled External automatic forwarding isn't restricted by the policy.
Off - Forwarding is disabled External automatic forwarding is blocked, and senders get an NDR.

Source: Control automatic external email forwarding (opens in a new tab). "Off" covers both user Inbox rules and admin-set mailbox (SMTP) forwarding to external addresses. Forwarding between internal users isn't affected.

Step by step

  1. Find who forwards today before you switch anything. Use the Auto forwarded messages report for cloud mailboxes (How to find users that are automatically forwarding (opens in a new tab)) and the read-only script below for mailbox-level forwards. Confirm each one with the owner; an unexplained forward to a personal or unknown address is an incident, not a setting.
  2. Set the default policy to Off. Defender portal: Email & collaboration > Policies & rules > Threat policies > Anti-spam (or https://security.microsoft.com/antispam), open Anti-spam outbound policy (Default), select Edit in the protection settings section, and under Forwarding rules set Automatic forwarding rules to Off - Forwarding is disabled (Configure outbound spam policies (opens in a new tab)).
  3. Allow the exceptions with a custom policy. Create an outbound policy (Create policy > Outbound) scoped to the specific users or a group that needs external forwarding, with On - Forwarding is enabled. Custom policies take priority over the default (Set the priority (opens in a new tab)).
  4. Optional: limit destinations. Remote domains and mail flow rules can also block forwarding; when one control allows it and another blocks it, the block typically wins. That lets you allow forwarding in the policy but restrict it to certain domains with remote domains (How the settings work with other controls (opens in a new tab)).
  5. Tell the help desk what the bounce looks like: 5.7.520 Access denied, Your organization does not allow external forwarding. Please contact your administrator for further assistance. AS(7555) (Blocked email forwarding messages (opens in a new tab)).

Read-only PowerShell (Exchange Online)

Read-only. Module: ExchangeOnlineManagement (Connect-ExchangeOnline). Needs a read-only role group such as View-Only Organization Management or Global Reader. Not tested against a live tenant. There is no Microsoft Graph cmdlet for outbound spam policies, so this uses Exchange Online PowerShell.

Connect-ExchangeOnline
# 1) Forwarding mode on every outbound spam policy (Automatic, On or Off)
Get-HostedOutboundSpamFilterPolicy |
Select-Object Name, AutoForwardingMode |
Export-Csv .\outbound-forwarding-mode.csv -NoTypeInformation
# 2) Mailboxes with an admin-set (SMTP) forward
Get-EXOMailbox -ResultSize Unlimited -Properties ForwardingSmtpAddress,ForwardingAddress,DeliverToMailboxAndForward |
Where-Object { $_.ForwardingSmtpAddress -or $_.ForwardingAddress } |
Select-Object DisplayName, PrimarySmtpAddress, RecipientTypeDetails, ForwardingSmtpAddress, ForwardingAddress, DeliverToMailboxAndForward |
Export-Csv .\mailbox-forwarding.csv -NoTypeInformation

AutoForwardingMode values are Automatic, On and Off (Set-HostedOutboundSpamFilterPolicy (opens in a new tab)). ForwardingSmtpAddress is typically an external address; ForwardingAddress is an internal recipient; DeliverToMailboxAndForward controls whether a copy stays in the mailbox (Set-Mailbox (opens in a new tab)). Get-EXOMailbox returns a minimal property set unless you ask for more with -Properties (Get-EXOMailbox (opens in a new tab)). This script doesn't list Inbox rules; see Check a mailbox for malicious inbox rules and forwarding for one user.

Gotchas

Check it worked

Roll back

Set Automatic forwarding rules back to its previous value on the default policy, or add the affected mailbox to the exception policy. Disabling forwarding disables existing external Inbox-rule and mailbox forwards while the block is in place.

Related on EntraReady: Set up DKIM and DMARC, Cut off a compromised or departing user now, Investigate risky users and sign-ins, Unblock a user restricted from sending email.

← All Guides

Is this still accurate?

Spotted something outdated or wrong on this page? Tell us in a sentence. The page address is sent with it.

Reports go to the EntraReady inbox. Please don’t include passwords or tenant secrets.