Skip to main content
Five Steps for Cloud Compliance Readiness·A practical playbook for security teamsDownload
Insight · Microsoft 365

External mail forwarding

External mail forwarding means mail from your Microsoft 365 mailboxes is automatically copied or redirected to an address outside your organization, either through a user's inbox rule or an admin-set mailbox forward. Microsoft notes that this can disclose information and that a compromised account can be the reason a rule exists, so each external forward deserves a check.

Why it matters

Microsoft describes automatic forwarding to external recipients as useful but also a security risk, because of the potential disclosure of information that attackers might use against your organization or partners. Two kinds exist: users can create inbox rules that forward externally (deliberately or because the account was compromised), and admins can set mailbox forwarding (also called SMTP forwarding). The outbound spam filter policy controls this with three values: Automatic - System-controlled, On - Forwarding is enabled and Off - Forwarding is disabled. Microsoft recommends setting On or Off explicitly, because the Automatic value behaves differently depending on the organization. (Microsoft Learn: Control external email forwarding)

Find it yourself

The script below is read-only: it only lists inbox rules and verified domains through Microsoft Graph and changes nothing. It reports rules whose forward or redirect target sits in a domain that is not one of your verified domains. Run it with an identity allowed to read mailbox settings of the users you check.

Connect-MgGraph -Scopes 'User.Read.All','MailboxSettings.Read','Domain.Read.All'
$own = (Get-MgDomain -All).Id
foreach ($u in Get-MgUser -All -Property Id,UserPrincipalName) {
  $rules = Get-MgUserMailFolderMessageRule -UserId $u.Id -MailFolderId inbox -ErrorAction SilentlyContinue
  foreach ($r in $rules) {
    $targets = @($r.Actions.ForwardTo) + @($r.Actions.RedirectTo) + @($r.Actions.ForwardAsAttachmentTo)
    foreach ($t in $targets | Where-Object { $_ }) {
      $domain = ($t.EmailAddress.Address -split '@')[-1]
      if ($own -notcontains $domain) {
        [pscustomobject]@{ User = $u.UserPrincipalName; Rule = $r.DisplayName; Enabled = $r.IsEnabled; Target = $t.EmailAddress.Address }
      }
    }
  }
}

This covers inbox rules only. Admin-set mailbox forwarding is not part of this script; Microsoft points to the Auto forwarded messages report for cloud-based accounts. (Microsoft Learn: List messageRules)

Read the result

Each output row is one inbox rule that sends mail to a domain outside your verified domains. Check whether the owner knows the rule: a forward the user never created, a rule with an unfamiliar target, or a freshly created hidden-looking rule are reasons to treat the account as possibly compromised. Rules to a partner or a personal address that the business knowingly uses are a policy question rather than an incident. Empty output means no inbox rule matched, not that forwarding is impossible, since mailbox forwarding set by an admin is outside this check.

What to do next

Decide whether external automatic forwarding should be allowed at all. If not, set the outbound spam filter policy to Off - Forwarding is disabled; Microsoft notes this disables inbox rules and mailbox forwarding that redirect to external addresses, and senders receive a non-delivery report with error 5.7.520. If some forwarding is needed, set the policy to On and narrow it with remote domains or mail flow rules, where a block takes precedence. For any suspicious rule, review the account's sign-ins and reset its credentials before removing the rule. (Microsoft Learn)

See it on every scan

ConfigCobra's Inventory & Insights keeps one inventory across clouds, with a per-cloud and an "All clouds" view, and "External mail forwarding" is one of its built-in risk views. On Microsoft 365 the Inventory covers mailboxes and shows this view without a script. Findings are linked to the inventory objects they concern, the relation graph shows how objects connect, and the list can be exported as CSV. Scheduled scans (daily, weekly or monthly) and drift detection alert you when a control regresses; ConfigCobra is read-only and never changes your environment.

See it for your whole tenant, continuously

Inventory & Insights lists these risks with built-in views and CSV export, read-only.

Get in touch

Let's talk.

Whether you're evaluating ConfigCobra, running an audit, or managing a client fleet — we respond within one business day.

Free trial