Forward email rule as the name implies, enable to forward automatically each email that sent to a particular mailbox to an additional email address.
The “Destination recipient” (E-mail address) could be “internal Mailbox” meaning a recipient from our organization or external recipient, meaning – recipient doesn’t belong to the organization (there is a different PowerShell Parameter for each of the options).
An additional parameter is an option of leaving a copy of the email in the source recipient mailbox or just forward the email message.
Article Table of content | Click to Expand
PowerShell | Help & additional information
Running PowerShell commands in Office 365 based environment
To be able to run the PowerShell commands specified in the current article, you will need to create a remote PowerShell with Azure Active Directory or Exchange Online. In case that you need help with the process of creating a Remote PowerShell session, you can use the links on the bottom of the Article.
In this article, we will demonstrate a couple of scenarios for Mail Forwarding:
- Mail forwarding to an internal recipient: John and Suzan are recipients who belong to the office 365 domain names: o365info.com
- Mail forwarding to External recipient: John wants to forward each mail that he gets to an external email address: [email protected]
- Additional scenarios are: Mail Forwarding in Bulk mode – the option of forwarding email to a destination email address for all the office 365 users and a nice trick of email forwarding that will implement for external contact object.
1. Set mail forwording
ADMIN Forwarding (ForwardingAddress)
ADMIN Forwarding (ForwardingAddress) – Forward Email to Recipient & SAVE local copy (Default)
PowerShell command syntax
1 | Set-Mailbox <Mailbox> -ForwardingAddress <Destination Recipient E-mail address> |
PowerShell command Example
1 | Set-Mailbox Angelina -ForwardingAddress Bradp@o365info.com |
ADMIN Forwarding (ForwardingAddress) – Forward Email to Recipient DONT SAVE a local copy
PowerShell command syntax
1 | Set-Mailbox <Mailbox> -ForwardingAddress <Destination Recipient E-mail address> -DeliverToMailboxAndForward $False |
PowerShell command Example
1 | Set-Mailbox Angelina -ForwardingAddress Bradp@o365info.com -DeliverToMailboxAndForward $False |
USER Forwarding (ForwardingsmtpAddress)
Admin Forwarding (ForwardingsmtpAddress) – Forward Email to Recipient & SAVE local copy (Default)
PowerShell command syntax
1 | Set-Mailbox <Mailbox> -ForwardingsmtpAddress <Destination Recipient E-mail address> |
PowerShell command Example
1 | Set-Mailbox Angelina -ForwardingsmtpAddress Bradp@o365info.com |
Admin Forwarding (ForwardingsmtpAddress) – Forward Email to Recipient DONT SAVE a local copy
PowerShell command syntax
1 | Set-Mailbox <Mailbox> -ForwardingsmtpAddress <Destination Recipient E-mail address> -DeliverToMailboxAndForward $False |
PowerShell command Example
1 | Set-Mailbox Angelina -ForwardingsmtpAddress Bradp@o365info.com -DeliverToMailboxAndForward $False |
Create External contact with internal email address + Forward email address (External Email Address)
Step 1: Create External contact with External email address
PowerShell command syntax
1 | New-MailContact -Name <Display Name> -ExternalEmailAddress <External Recipient Email Address> |
Step 2: Set External contact email address to internal email address and forwarding email address (External email address) PowerShell command syntax:
PowerShell command syntax
1 | New-MailContact <Display Name> -emailaddresses SMTP:<Office 365 User Email Address>, <External Recipient Email Address> |
PowerShell command Example
Step 1: Create External contact with External email address
1 | New-MailContact -Name "David bowie" -ExternalEmailAddress Davidbowie@hotmail.com |
1 | Set-MailContact "David bowie" -emailaddresses SMTP:David@o365info.com,Davidbowie@hotmail.com |
2. Display information about mailbox Forwarding settings
Display information about Specific Mailbox Forwarding settings
PowerShell command syntax
1 | Get-Mailbox <MailBox> | FL DeliverToMailboxAndForward,ForwardingAddress,ForwardingSmtpAddress |
PowerShell command Example
1 | Get-Mailbox Bradp@o365info.com | FL DeliverToMailboxAndForward,ForwardingAddress,ForwardingSmtpAddress |
Find all Recipients (Display list) with ADMIN Forwarding or USER Forwarding
PowerShell command Example
1 | Get-Mailbox -ResultSize Unlimited | Where {($_.ForwardingAddress -ne $Null) -or ($_.ForwardingsmtpAddress -ne $Null)} | Select Name, ForwardingAddress, ForwardingsmtpAddress, DeliverToMailboxAndForward |
3. Disable (remove) E-mail Forwarding option
Disable (cancel) ADMIN Forwarding (ForwardingAddress) Specific MAILBOX
PowerShell command syntax
1 | Set-Mailbox <MailBox> -ForwardingAddress $Null |
PowerShell command Example
1 | Set-Mailbox Bradp@o365info.com -ForwardingAddress $Null |
Disable (cancel) USER Forwarding (ForwardingsmtpAddress) Specific MAILBOX
PowerShell command syntax
1 | Set-Mailbox <MailBox> -ForwardingSmtpAddress $Null |
PowerShell command Example
1 | Set-Mailbox Bradp@o365info.com -ForwardingSmtpAddress $Null |
Disable (cancel) ADMIN Forwarding (ForwardingAddress) ALL MAILBOXES (BULK mode)
PowerShell command Example
1 | Get-Mailbox -ResultSize Unlimited| Where-Object {($_.ForwardingAddress -ne $Null) } | Set-Mailbox -ForwardingAddress $Null |
Disable (cancel) USER Forwarding (ForwardingsmtpAddress) ALL MAILBOXES (BULK mode)
PowerShell command Example
1 | Get-Mailbox -ResultSize Unlimited | Where-Object {($_.ForwardingsmtpAddress -ne $Null) } | Set-Mailbox -ForwardingsmtpAddress $Null |
4. Export information about forwarding settings
Exoprt informaiton about USER Forwarding rule
Export to CSV file:
PowerShell command Example
1 | Get-Mailbox -ResultSize Unlimited | Where-Object {($_.ForwardingsmtpAddress -ne $Null) } | Select-Object DisplayName,Alias, PrimarySmtpAddress, ForwardingAddress, ForwardingsmtpAddress, DeliverToMailboxAndForward, RecipientType,RecipientTypeDetails | Export-CSV C:\TEMP\"All Recipents that have USER Forwarding(ForwardingsmtpAddress).CSV" –NoTypeInformation -Encoding utf8 |
Exoprt informaiton about ADMIN Forwarding rule
Export to CSV file:
PowerShell command Example
1 2 | $fwds = Get-Mailbox -ResultSize Unlimited | Where-Object { $_.ForwardingAddress -ne $null } | Select-Object DisplayName,Alias, name, ForwardingAddress ; foreach ($fwd in $fwds) {$fwd | add-member -membertype noteproperty -name “ContactAddress” -value (get-contact $fwd.ForwardingAddress).WindowsEmailAddress} ; $fwds | Export-CSV C:\TEMP\"All Recipents that have Admin Forwarding(ForwardingAddress).CSV" –NoTypeInformation -Encoding utf8 |
Exoprt informaiton about User inbox Forwarding rule
Export to CSV file:
PowerShell command Example
1 | $UserInboxRule = ForEach ($i in (Get-Mailbox -ResultSize Unlimited)) {Get-InboxRule -Mailbox $i.DistinguishedName | Where-Object {$_.ForwardTo} | fl MailboxOwnerID,Name,ForwardTo,Description} $UserInboxRule | Out-File C:\TEMP\"User inbox Forwarding rule.txt" -Encoding UTF8 |
5. Forward Email of ALL Users to Additional email address (Bulk mode)
4.1 – Forward Email of ALL Users to internal Recipient & save local copy
PowerShell command Syntax
Step 1: Save local copy
1 | Get-Mailbox | Where {$_.RecipientType -eq "UserMailbox"}| Set-Mailbox -DeliverToMailboxAndForward $True |
Step 2: Forward email to the destination recipient (internal\organization recipient)
PowerShell command syntax
1 | Get-Mailbox | Where {$_.RecipientType -eq "UserMailbox"}| Set-Mailbox -ForwardingAddress <Office 365 User Email Address> |
PowerShell command Example
Step 1: Save local copy
1 | Get-Mailbox | Where {$_.RecipientType -eq "UserMailbox"}| Set-Mailbox -DeliverToMailboxAndForward $True |
Step 2: Forward email to the destination recipient (internal\organization recipient)
1 | Get-Mailbox | Where {$_.RecipientType -eq "UserMailbox"}| Set-Mailbox -ForwardingAddress Suzan@o365info.com |
4.2 – Forward Email of ALL Users to External Recipient & save local copy
Step 1: Save local copy
1 | Get-Mailbox | Where {$_.RecipientType -eq "UserMailbox"}| Set-Mailbox -DeliverToMailboxAndForward $True |
Step 2: Forward email to the destination recipient (internal\organization recipient)
PowerShell command syntax
1 | Get-Mailbox | Where {$_.RecipientType -eq "UserMailbox"}| Set-Mailbox -ForwardingSmtpAddress <External Recipient Email Address> |
Step 1: Save local copy
1 | Get-Mailbox | Where {$_.RecipientType -eq "UserMailbox"}| Set-Mailbox -DeliverToMailboxAndForward $True |
1 | Get-Mailbox | Where {$_.RecipientType -eq "UserMailbox"} | Set-Mailbox -ForwardingSmtpAddress Suzan@Hotmail.com |
4.3 – Forward Email to External Recipient & save local copy | import from CSV File |Scenario 1
Step 1: Enable to option of DeliverToMailboxAndForward
1 2 3 | $Mailboxes= Import-CSV C:\Temp\Users.csv ForEach ($Mailbox in $Mailboxes) {Set-Mailbox $Mailbox.users -DeliverToMailboxAndForward $True} |
PowerShell command syntax
1 2 3 | $Mailboxes= Import-CSV C:\Temp\Users.csv ForEach ($Mailbox in $Mailboxes) {Set-Mailbox $Mailbox.users -ForwardingAddress Suzan@o365info.com} |

4.4 – Forward Email to External Recipient & save local copy | import from CSV File |Scenario 2
Step 1: Enable to option of DeliverToMailboxAndForward
1 | Import-CSV "C:\Temp\Users.csv" | % { $_.Condition = [bool]($_.Condition -as [int]); $_ } | ForEach {Set-Mailbox -Identity $_.mailbox -ForwardingAddress $_.forwardto -Delivertomailboxandforward $_.Condition} |
Example
6. Download PowerShell menu script
Getting started with Office 365 PowerShell
Get more information about the Naming Conventions that are used in the PowerShell articles – Help and additional information – o365info.com PowerShell articles
To get more information about the required remote PowerShell commands that you need to use for connecting to Exchange Online, read the following article:
Connect to Exchange Online by using Remote PowerShell
To get more information about the required software component + the remote PowerShell commands that you need to use for connecting Azure Active Directory, read the following article: Part 2: Connect to Office 365 by using Remote PowerShell
If you are new in the PowerShell world, you can read more information about how to start working with PowerShell in Office 365 based environment in the following article series: Getting started with Office 365 PowerShell – Part 1, Part 2, Part 3 and Part 4.
In case that you need more information about how to use the o365info PowerShell scripts that I add to the PowerShell articles, you can read the article – How to run and use o365info PowerShell menu script
Additional reading
It is important for us to know your opinion on this article


Great article which makes things easy.
But what is the difference between -ForwardingAddress and -ForwardingSmtpAddress ???
-ForwardingAddress (internal; within organtization), -ForwardingSmtpAddress (external; forward to an email address outside of your organization)
Forward Email to internal Recipient & save local copy (Default)
Is not the default setting in my office365 config.
The default is Forward Email to internal Recipient & DONT save local copy
So the command will be Set-Mailbox -Identity -ForwardingAddress -DeliverToMailboxAndForward $true
this is very great and another way to get anonymous email for everyone and your primary email id will remain hidden but you will receive emails on your primary email ID. Its very great and just amazing. make anonymous email
“Forward Email to External Recipient & DONT save local copy” => Does this really work? In our case we failed with tests using ForwardingsmtpAddress and what I could read in other discussions our experience was confirmed.
Very helpful thank you so much for sharing.
How do I forward e-mails from a specific domain to another mailbox?
Wow, great resource. I was just thrown into the mix with O365, and this helps immensely!
This wave 15 OWA content link could be added to additional reading:
http://office.microsoft.com/en-us/support/use-rules-in-outlook-web-app-to-automatically-forward-messages-to-another-account-HA102919115.aspx
Also, this for Outlook 2013:
http://office.microsoft.com/en-us/outlook-help/forward-messages-automatically-with-a-rule-HA103465692.aspx?CTT=1
Thanks to the comments above this is the command that I found to work for “Forwarding Email to External Recipient & save local copy | import from CSV File |Scenario 2”:
Import-CSV “C:\Temp\Users.csv” | % { $_.Condition = [bool]($_.Condition -as [int]); $_ } | ForEach {Set-Mailbox -Identity $_.mailbox -ForwardingSmtpAddress $_.forwardto -Delivertomailboxandforward $TRUE}
Can someone help me with a script to Forward Email to External Recipient & DONT SAVE local copy | import from CSV File
How come -ForwardingSMTPAddress should be used to forward to external email addresses, but the script in section 4.4 “Forward Email to External Recipient & save local copy | import from CSV File” uses -ForwardingAddress
Import-CSV “C:\Temp\Users.csv” | % { $_.Condition = [bool]($_.Condition -as [int]); $_ } | ForEach {Set-Mailbox -Identity $_.mailbox -ForwardingAddress $_.forwardto -Delivertomailboxandforward $_.Condition}
Is this just an error in the script? Or is there a reason for this?
Thank you so much, I used “2.2 – Find all users with Forwarding Address is set to Internal Recipient” to find an old mailbox that was causing problems for us! Very nice resource you have with this page.
Oh my goodness! Amazing article dude! Many thanks, However I am going through issues with your RSS.
I don’t understand why I cannot join it. Is there anybody else getting identical RSS problems?
Anyone that knows the solution will you kindly respond? Thanx!!
Great Article. Is there a way to turn on forwarding for a mailbox and it will stop forwarding after 60 days?
I actually adore your post. I read your site pretty regularly and you are always coming out with some
great items. I shared this on my FB and my followers only loved it.
Keep up the good work!
Thank you so so much!
#appreciate