About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
A message that a user's mailbox tried to forward to an outside address came back to the sender with this text: "5.7.520 Access denied, Your organization does not allow external forwarding. Please contact your administrator for further assistance. AS(7555)". Microsoft says this NDR is produced when a message is detected as automatically forwarded and the outbound spam filter policy blocks that activity. The control is the "Automatic forwarding rules" setting of an outbound spam policy. The narrowest fix is to allow forwarding for named users and keep it off for everyone else.
The default value is "Automatic - System-controlled", and Microsoft says it changed in 2021 for new organisations and for those not actively using it.
What the error means
Microsoft describes two kinds of automatic forwarding. Users can create Inbox rules that forward to external recipients, deliberately or because an account is compromised. Admins can configure mailbox forwarding, also called SMTP forwarding, to forward to external recipients. Both are controlled by the outbound spam filter policy.
The policy has three settings for external forwarding:
- Automatic - System-controlled: the default. When introduced, it was equivalent to On. In 2021 the value changed to Off for new organisations and for existing organisations that were not actively using it. Organisations that were already using it can still have it equivalent to On. Microsoft's advice is to configure On or Off explicitly because the behaviour differs by organisation.
- On - Forwarding is enabled: automatic external forwarding is allowed and not restricted.
- Off - Forwarding is disabled: automatic external forwarding is disabled and results in an NDR to the sender.
Who sees the bounce depends on the forwarding method. Microsoft's policy page says that when automatic forwarding is disabled, NDRs are generated for messages from external senders for all forwarding methods, and for messages from internal senders if the method is mailbox forwarding. If the method is an Inbox rule, no NDR is generated for internal senders. So a user can have a forwarding rule that silently stops working for colleagues, while outside senders get a bounce.
Two points matter for scope. Automatic forwarding between internal users is not affected by these settings. And users who forward automatically from an on-premises email system through Microsoft 365 are subject to the same controls as cloud mailboxes.
Other controls can also stop forwarding: remote domains, and mail flow (transport) rules that detect forwarded messages. Microsoft gives a table of what happens when one setting allows forwarding and another blocks it. In the examples shown, the block is the result, for instance when remote domains allow forwarding but the outbound spam policy is Off.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| Policy set to Off - Forwarding is disabled | NDR 5.7.520 for every forwarding mailbox the policy covers | Policy flyout shows the forwarding value |
| Policy left at Automatic - System-controlled in an organisation where it behaves as Off | Forwarding stopped without any recent change by your team | Value is Automatic; organisation is new or was not using it |
| A higher-priority custom policy applies Off to the user | One user blocked, others allowed | Custom policy priority and its sender conditions |
| A remote domain or mail flow rule blocks while the policy allows | NDR continues despite policy set to On | Remote domain settings and mail flow rules |
Prove the cause before changing anything
Read, do not change. In the Microsoft Defender portal go to Email & collaboration, then Policies & rules, then Threat policies, then Anti-spam (direct address https://security.microsoft.com/antispam). Select an outbound policy row to open its details flyout and read the Forwarding rules section. Do this for the default policy and for each custom outbound policy.
Outbound policies are applied in priority order, a lower number meaning higher priority, and protection stops after the first policy that applies to a sender. So a user can be covered by a custom policy even though the default says On. In PowerShell, list policies and rules without changing them, and keep the output in files you can read later:
Get-HostedOutboundSpamFilterPolicy | Format-List | Out-File -FilePath .\outbound-policies-before.txt
Get-HostedOutboundSpamFilterRule | Format-List | Out-File -FilePath .\outbound-rules-before.txt
To find who is forwarding, use the Auto forwarded messages report for cloud accounts. For on-premises users forwarding through Microsoft 365, Microsoft describes a mail flow rule with the condition that the message header X-MS-Exchange-Inbox-Rules-Loop matches . and an action such as setting a header X-Forwarded to True.
Look for forwarding rules nobody should have. Microsoft's compromised-account page lists "Rules that automatically forward email to unknown addresses" and "Recently added external email forwarding" among symptoms of a compromised mailbox. A forward to an address you do not recognise is a security matter first.
Example (illustrative): Contoso has 60 staff and the default policy is Off. Three of them, in the accounts team, forward invoices to ap@contoso-books.com.au, an outside bookkeeper. Allowing forwarding in the default policy would open all 60 mailboxes. A custom policy applied to just those three leaves 60 - 3 = 57 mailboxes blocked.
Fix
Option 1: allow forwarding for named users only.
Risk: the custom policy you create below applies all of its settings to those users, including the message limits and restrictions, not only forwarding. Check those values before you save.
Create a custom outbound spam policy. In the Anti-spam page choose Create policy, then Outbound. Name it, then on the Users, groups, and domains page add only the users who need forwarding. On Protection settings, in the forwarding section, choose "On - Forwarding is enabled". Microsoft's notes on the conditions help here. Groups can be distribution groups or mail-enabled security groups, but dynamic distribution groups are not supported. Several values of the same condition use OR logic, while different condition types use AND logic, so a user listed and also required to be in a group must satisfy both. The default policy always has the priority Lowest. If you already have other custom outbound policies, check the new policy's priority against them, because protection stops after the first policy that applies to a sender.
To undo it: select the policy and choose Turn off, or Delete policy, in the flyout. Both are custom-policy actions.
Option 2: change the default policy.
Save first: before either change, write down the current value shown in the flyout.
Disruptive step: the portal steps below change the default policy. Setting the default to "Off - Forwarding is disabled" disables every Inbox rule and mailbox forwarding that redirects messages to external addresses, so existing forwards stop. Microsoft says this plainly. Setting it to "On" allows forwarding for the whole organisation, which Microsoft warns can disclose information.
Select the default policy, choose Edit in the forwarding section, and pick the value.
To undo it: edit the section again and select the value you wrote down.
Option 3: allow forwarding only to chosen domains. Microsoft notes you can allow forwarding in the outbound spam policy but use remote domains to control which external domains users can forward to. That means the outbound spam policy's "Automatic forwarding rules" setting is On and the remote domains do the blocking. If the policy stays at Off, the remote-domain change alone does not stop the 5.7.520, so the last step below sets it to On. Microsoft's remote domains page says that automatic forwarding is a remote domain setting ("The default is to allow automatic forwarding."), and that "messages are blocked if automatic forwards are disabled for the remote domain". Changes to the built-in Default remote domain apply to every external domain that has no remote domain of its own. So the pattern is: the Default remote domain blocks automatic forwarding, and a remote domain for each partner you trust allows it. The setting is the AutoForwardEnabled parameter of Set-RemoteDomain. This only works for Inbox rules and Outlook on the web forwarding. Microsoft's page says forwarding an admin sets up (mailbox forwarding or a mail flow rule) is not affected by remote domain settings.
First record every remote domain's current settings in Exchange Online PowerShell, and write down the default outbound spam policy's current forwarding value as in Option 2:
Get-RemoteDomain | Format-List | Out-File -FilePath .\remote-domains-before.txt
Risk: creating the partner's remote domain adds an object to your organisation. Microsoft's Manage remote domains page gives the syntax New-RemoteDomain -Name "Unique Name" -DomainName domain; the name you choose is the Identity that the next commands use. Back-out: Remove-RemoteDomain -Identity "Contoso Books". Microsoft says that when you remove a remote domain, the Default remote domain's settings apply to messages sent to that domain.
New-RemoteDomain -Name "Contoso Books" -DomainName contoso-books.com.au
Disruptive step: setting AutoForwardEnabled to $false on the Default remote domain stops automatically forwarded messages being delivered to every external domain that has no remote domain of its own, so every existing Inbox-rule forward to such a domain stops. Save-first: remote-domains-before.txt. Back-out: run the same command with the value recorded in that file for the Default domain. Do the partner's $true first and the Default's $false second.
Set-RemoteDomain -Identity "Contoso Books" -AutoForwardEnabled $true
Set-RemoteDomain -Identity "Default" -AutoForwardEnabled $false
To go back, use -AutoForwardEnabled $true on Default if the file shows True. The reference gives $true as the default for new remote domains and for the built-in Default remote domain in Exchange Online.
Disruptive step: only now set the default outbound spam policy's forwarding value to "On - Forwarding is enabled" (the Option 2 steps), and do it in the same change window, so no gap opens between the policy and the remote domains. On lets every mailbox forward, including mailbox (SMTP) forwarding that an admin sets up, which remote domain settings do not control. Save-first: the value you wrote down. Back-out: edit the section again and select that value.
Confirm the fix
Send a test from an outside address to a mailbox covered by the new policy and confirm it reaches the external forward target. Run the Auto forwarded messages report and confirm the user shows. Confirm that a user not covered by the policy still gets the 5.7.520 NDR, which shows the other 57 mailboxes in the example remain blocked. Allow time: Microsoft gives no figure for how long a policy change takes, so recheck after a short wait before changing anything else.
What to watch afterwards
- The list of users with forwarding allowed. Check it when staff leave or change roles, and remove anyone who no longer needs it.
- New forwarding rules on accounts outside the list, which appear as NDRs and as entries in the report.
- Any user who suddenly forwards to an address you do not recognise.
- The User restricted from sending email alert and the Restricted entities page, because a compromised forwarding account can be restricted separately.
Read next
Related articles you may want next.
- TroubleshootingExchange Online 'Fix NDR error 550 5.7.133': outside senders can't email a distribution group550 5.7.133 means a distribution group rejects outside senders. Allow external mail or add named senders to the allowed list, and see each risk.Read article
- TroubleshootingExchange Online '550 5.1.8 Access denied, bad outbound sender': a user is restricted from sending in Microsoft 365550 5.1.8 bad outbound sender: a user is on the Restricted entities page. Check for compromise first, then unblock in the portal or PowerShell.Read article
- CloudEntra ID Conditional Access: tenant lockout, break-glass accounts and how to test policy safelyHow Conditional Access locks administrators out, how to build emergency accounts that work under mandatory MFA, and a safe order for testing policy.Read article
Risks and limits
These commands have not been run or lab-tested. The Get- commands only read settings and write a file. The only changing commands are the New-RemoteDomain and Set-RemoteDomain lines in Option 3, which have their own save-first step and back-out. Microsoft's pages give the portal steps for changing the forwarding value in the outbound spam policy and no PowerShell parameter for it, so none is shown. The setting covers automatic forwarding only, as Microsoft describes it: Inbox rules and mailbox (SMTP) forwarding. Microsoft's page shows AS(7555) at the end of the NDR text. Match on the 5.7.520 code and wording, and do not rely on that number.
Sources
- Control automatic external email forwarding from cloud mailboxes — Microsoft Learn, page dated 2026-08-18, accessed 20 November 2026
- Configure outbound spam policies for cloud mailboxes — Microsoft Learn, page dated 2026-08-10, accessed 20 November 2026
- Respond to a compromised cloud email account — Microsoft Learn, page dated 2026-07-17, accessed 20 November 2026
- Remote domains in Exchange Online — Microsoft Learn, page dated 2023-02-22, accessed 20 November 2026
- Manage remote domains in Exchange Online — Microsoft Learn, page dated 2023-02-22, accessed 20 November 2026
- Get-RemoteDomain — Microsoft Learn, date not shown, accessed 20 November 2026
- Set-RemoteDomain — Microsoft Learn, date not shown, accessed 20 November 2026
- Out-File — Microsoft Learn, date not shown, accessed 20 November 2026
- Remove blocked users from the Restricted entities page — Microsoft Learn, page dated 2026-10-30, accessed 20 November 2026
This article was originally published on .