/config/exchange-online/forwardingsmtpaddress
Set-Mailbox -ForwardingSmtpAddress and -DeliverToMailboxAndForward (mail forwarding)
- tool
- Exchange Online PowerShell
- file
- Mailbox object (Set-Mailbox)
- key
- ForwardingSmtpAddress
- type
- ProxyAddress (smtp:address)
- default
- $null (no forwarding)
ForwardingSmtpAddress is the mailbox property that forwards incoming mail to another SMTP address, typically an external one. DeliverToMailboxAndForward decides whether the mailbox keeps a copy. Set both in one command:
Set-Mailbox -Identity john@contoso.com -ForwardingSmtpAddress "smtp:manuel@fabrikam.com" -DeliverToMailboxAndForward $trueWithout -DeliverToMailboxAndForward $true (the default is $false), mail is only forwarded and nothing stays in the mailbox. Connect with Connect-ExchangeOnline first; the Recipient Management role group can run Set-Mailbox.
Forwarding properties
| Property | Type | Meaning |
|---|---|---|
| ForwardingSmtpAddress | ProxyAddress | Any SMTP address, not validated; usually external |
| ForwardingAddress | Recipient | A recipient in your organization (mailbox, mail user, contact) |
| DeliverToMailboxAndForward | Boolean, default $false | $true delivers to the mailbox and forwards; $false only forwards |
If both ForwardingAddress and ForwardingSmtpAddress are set, ForwardingSmtpAddress is ignored and mail goes to the ForwardingAddress recipient.
Check and remove forwarding
Get-EXOMailbox -Identity john@contoso.com -Properties ForwardingSmtpAddress,ForwardingAddress,DeliverToMailboxAndForward |
Format-List ForwardingSmtpAddress,ForwardingAddress,DeliverToMailboxAndForward
Set-Mailbox -Identity john@contoso.com -ForwardingSmtpAddress $null -ForwardingAddress $null -DeliverToMailboxAndForward $falseTo find every mailbox that forwards somewhere:
Get-EXOMailbox -ResultSize Unlimited -Properties ForwardingSmtpAddress,ForwardingAddress |
Where-Object { $_.ForwardingSmtpAddress -or $_.ForwardingAddress } |
Select-Object UserPrincipalName,ForwardingSmtpAddress,ForwardingAddressForwarding is set but external mail is not forwarded
Exchange Online can block automatic external forwarding independently of this property. The outbound spam filter policy controls it (Get-HostedOutboundSpamFilterPolicy | Format-List Name,AutoForwardingMode): On allows automatic external forwarding, Off blocks it, and the default Automatic behaves as Off in most organizations since 2021. Remote domain settings can also stop it. When the policy blocks forwarding, the sender receives a non-delivery report; trace the message with Get-MessageTraceV2 to see it.
Sources
- learn.microsoft.comlearn.microsoft.com/en-us/powershell/module/exchangepowershell/set-mailbox
- learn.microsoft.comlearn.microsoft.com/en-us/powershell/module/exchangepowershell/get-exomailbox
- learn.microsoft.comlearn.microsoft.com/en-us/powershell/module/exchangepowershell/set-hostedoutboundspamfilterpolicy