Windows OS Hub / Exchange / Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365
In Exchange Server and Exchange Online (Microsoft 365), you can enable email forwarding at the mailbox level (configured by the administrator using the ForwardingAddress attribute), through mailbox Inbox rules, or directly from Outlook (users can do this themselves through the ForwardingSMTPAddress attribute).
Contents:
- Enable/Disable Forwarding on a User Mailbox with Exchange Admin Center
- Manage Email Forwarding for an Exchange Mailbox with PowerShell
Enable/Disable Forwarding on a User Mailbox with Exchange Admin Center
You can enable/disable email forwarding for a mailbox in the Exchange Admin Center:
You can enable and disable email forwarding for a user mailbox through the Exchange Admin Center:
- Sign in to the EAC web interface;
- Go to Recipients -> select a mailbox -> Edit;
- Click the Mailbox Features -> scroll down to Mail Flow -> View details;
- Check the Enable forwarding option and select a recipient user mailbox to which you would like all incoming emails to be forwarded;;
- You can also enable the option Deliver message to the both forwarding address and mailbox.
Manage Email Forwarding for an Exchange Mailbox with PowerShell
My preference is to use PowerShell to enable or disable email forwarding for Exchange mailboxes.
There are two attributes in Exchange that you can use to configure forwarding for a mailbox:
ForwardingAddress
ForwardingSmtpAddress
The ForwardingSmtpAddress attribute allows to enable email forwarding to any internal or external SMTP address. The Outlook/OWA GUI allows users to configure the target recipient address in this attribute. If an external SMTP address is specified here, such forwarding will only work for trusted external domains. Your Exchange administrator configures the list of trusted domains (Remote Domains) and whether you can automatically forward e-mail to them.
Get-RemoteDomain | fl DomainName,AutoForwardEnabled
Learn how to enable mail forwarding to external SMTP addresses in Microsoft 365/Exchange Online.
The ForwardingAddress attribute allows an administrator to configure email forwarding to any mail-enabled object in the Exchange organization. Users cannot directly change the value of this attribute.
Connect to your Exchange organization using PowerShell:
- If you are using an on-premises Exchange Server, connect to it using the PowerShell commands:
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://mun-exch1.woshub.com/PowerShell/ -Authentication Kerberos -Credential $UserCredential - You can use the Exchange Online PowerShell module to connect to a Microsoft 365 tenant:
Connect-ExchangeOnline -UserPrincipalName [emailprotected] -ShowProgress $true
You can use certificate-based authentication to connect Exchange Online/Microsoft 365.
To enable automatic e-mail forwarding to another mailbox in your organization, run the command below:
Set-Mailbox [emailprotected] -ForwardingAddress [emailprotected] -DeliverToMailboxAndForward $true
In this example, all emails sent to h.werner will be automatically forwarded to the maxadm mailbox. The DeliverToMailboxAndForward option indicates that an e-mail copy will be saved in the original recipient’s mailbox. If you set DeliverToMailboxAndForward $false
, the emails will not be delivered to the recipient’s original mailbox.
You can check whether email forwarding is enabled for a specific mailbox:
Get-Mailbox -Identity [emailprotected] |fl ForwardingAddress, ForwardingSmtpAddress, DeliverToMailboxAndForward
To disable automatic forwarding:
Set-Mailbox -Identity [emailprotected] -DeliverToMailboxAndForward $False -ForwardingAddress $null -ForwardingSmtpAddress $null
To find all mailboxes with automatic forwarding enabled in an organization:
Get-Mailbox -ResultSize Unlimited -Filter "ForwardingAddress -like '*' -or ForwardingSmtpAddress -like '*'" | Select-Object Name,ForwardingAddress,ForwardingSmtpAddress
In addition to auto-forwarding, you can configure auto-reply rules (Out of Office) for an Exchange mailbox.
If both the ForwardingAddress and ForwardingSMTPAddress attributes are configured for a mailbox, the ForwardingSMTPAddress value is ignored as less prioritized.
If you want to set up a mail forwarding to an external SMTP address using the ForwardingAddress attribute, you must first create a contact for such an address:
New-MailContact -Name "ext. Heinz Werner" -ExternalEmailAddress "[emailprotected]"
Then set up an internal email address for the contact:
Set-MailContact "ext. Heinz Werner" -EmailAddresses "SMTP:ext_h.werner @woshub.com,[emailprotected] "
Then use the Set-Mailbox cmdlet to configure forwarding to the external contact.
In addition to mailbox-level forwarding, users and administrators can configure Exchange Inbox rules (can be configured from within Outlook) to forward email.
For example, an administrator can create a mailbox rule to automatically forward all e-mails with the specific subject to a different mailbox:
New-InboxRule -Name ForwardPowerAlertstoHelpdesk -Mailbox h.werner -SubjectContainsWords "DC Power Alert" -ForwardTo "Helpdesk"
You can list all the mail forwarding rules that have been configured at the Outlook level for all the user mailboxes in the organization:
$mailboxes=get-mailbox–resultSizeunlimited
$rules=$mailboxes|foreach{get-inboxRule–mailbox$_.alias}
$rules|where{($_.forwardAsAttachmentTo–ne$NULL)–or($_.forwardTo–ne$NULL)–or($_.redirectTo–ne$NULL)} |ftname, MailboxOwnerId, ForwardTo, Description
You can configure mail forwarding rules not only for personal user mailboxes but also for shared Exchange mailboxes. You don’t need to grant yourself access to the mailbox when you create a mail forwarding rule from PowerShell.