Top

Manage Forward Mail by using PowerShell | Office 365 5/5 (10) 7 min read

Manage Forward Mail by using PowerShell | Office 3657 min read

In the current article, we review the use of the Forward email PowerShell command in Office 365 and Exchange Online environment.

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.

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:

  1. Mail forwarding to an internal recipient: John and Suzan are recipients who belong to the office 365 domain names: o365info.com
  2. Mail forwarding to External recipient: John wants to forward each mail that he gets to an external email address: [email protected]
  3. 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

PowerShell command Example

ADMIN Forwarding (ForwardingAddress) – Forward Email to Recipient DONT SAVE a local copy

PowerShell command syntax

PowerShell command Example

USER Forwarding (ForwardingsmtpAddress)

Admin Forwarding (ForwardingsmtpAddress) – Forward Email to Recipient & SAVE local copy (Default)

PowerShell command syntax

PowerShell command Example

Admin Forwarding (ForwardingsmtpAddress) – Forward Email to Recipient DONT SAVE a local copy

PowerShell command syntax

PowerShell command Example

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

Step 2: Set External contact email address to internal email address and forwarding email address (External email address) PowerShell command syntax:

PowerShell command syntax

PowerShell command Example

Step 1: Create External contact with External email address

Step 2: Set External contact email address to internal email address and forwarding email address (External email address) PowerShell command syntax:

2. Display information about mailbox Forwarding settings

Display information about Specific Mailbox Forwarding settings

PowerShell command syntax

PowerShell command Example

Find all Recipients (Display list) with ADMIN Forwarding or USER Forwarding

PowerShell command Example

3. Disable (remove) E-mail Forwarding option

Disable (cancel) ADMIN Forwarding (ForwardingAddress) Specific MAILBOX

PowerShell command syntax

PowerShell command Example

Disable (cancel) USER Forwarding (ForwardingsmtpAddress) Specific MAILBOX

PowerShell command syntax

PowerShell command Example

Disable (cancel) ADMIN Forwarding (ForwardingAddress) ALL MAILBOXES (BULK mode)

PowerShell command Example

Disable (cancel) USER Forwarding (ForwardingsmtpAddress) ALL MAILBOXES (BULK mode)

PowerShell command Example

4. Export information about forwarding settings

Exoprt informaiton about USER Forwarding rule

Export to CSV file:
PowerShell command Example

Exoprt informaiton about ADMIN Forwarding rule

Export to CSV file:
PowerShell command Example

Exoprt informaiton about User inbox Forwarding rule

Export to CSV file:
PowerShell command Example

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

Step 2: Forward email to the destination recipient (internal\organization recipient)

PowerShell command syntax

PowerShell command Example
Step 1: Save local copy

Step 2: Forward email to the destination recipient (internal\organization recipient)

4.2 – Forward Email of ALL Users to External Recipient & save local copy

Step 1: Save local copy

Step 2: Forward email to the destination recipient (internal\organization recipient)

PowerShell command syntax

PowerShell command Example
Step 1: Save local copy
Step 2: Forward email to the destination recipient (External recipient)

4.3 – Forward Email to External Recipient & save local copy | import from CSV File |Scenario 1

Step 1: Enable to option of DeliverToMailboxAndForward

Step 2: Forward email to the destination recipient (internal\organization recipient)

PowerShell command syntax

Example
Forward Email to External Recipient & save local copy  import from CSV File Scenario 1

4.4 – Forward Email to External Recipient & save local copy | import from CSV File |Scenario 2

Step 1: Enable to option of DeliverToMailboxAndForward

Example
Forward Email to External Recipient & save local copy  import from CSV File Scenario 2

6. Download PowerShell menu script

Getting started with Office 365 PowerShell

PowerShell Naming Conventions & general information
Get more information about the Naming Conventions that are used in the PowerShell articles – Help and additional information – o365info.com PowerShell articles
Creating a remote PowerShell session to Exchange Online 
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
Creating a remote PowerShell session to Azure Active Directory
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
Basic introduction to PowerShell in Office 365 based environment
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.
Running and using o365info PowerShell scripts
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

PowerShell command syntax – Office 365 | Article series index

Now it’s Your Turn!
It is important for us to know your opinion on this article

Summary
Manage Forward Mail by using PowerShell | Office 365
Article Name
Manage Forward Mail by using PowerShell | Office 365
Description
In the current article, we review the use of the Forward mail PowerShell command in Office 365 and Exchange Online environment.
Author
Publisher Name
o365info.com
Publisher Logo

Please rate this

[email protected]

Share your knowledge. It’s a way to achieve immortality. Dalai Lama

17 Comments
  • Anonymous
    11/29/2012 at 2:24 pm

    Great article which makes things easy.
    But what is the difference between -ForwardingAddress and -ForwardingSmtpAddress ???

  • Anonymous
    12/28/2012 at 9:08 am

    -ForwardingAddress (internal; within organtization), -ForwardingSmtpAddress (external; forward to an email address outside of your organization)

  • Anonymous
    01/09/2013 at 11:14 am

    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

  • David Warner
    06/16/2013 at 5:37 am

    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

  • Anonymous
    08/07/2013 at 5:38 am

    “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.

  • Anonymous
    12/04/2013 at 11:48 am

    Very helpful thank you so much for sharing.

  • Anonymous
    12/05/2013 at 10:14 am

    How do I forward e-mails from a specific domain to another mailbox?

  • Darko Teodorovic
    03/19/2014 at 12:19 pm

    Wow, great resource. I was just thrown into the mix with O365, and this helps immensely!

  • Mick
    02/05/2015 at 9:42 pm

    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}

  • 2MyCloud
    02/08/2016 at 2:39 pm

    Can someone help me with a script to Forward Email to External Recipient & DONT SAVE local copy | import from CSV File

  • Ben
    03/26/2016 at 8:13 pm

    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?

  • Adam
    05/20/2016 at 12:05 am

    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.

  • Lenard
    11/19/2016 at 3:28 pm

    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!!

  • Danny Nguyen
    01/18/2017 at 7:29 pm

    Great Article. Is there a way to turn on forwarding for a mailbox and it will stop forwarding after 60 days?

  • josh
    04/09/2017 at 2:34 am

    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!

  • Navishkar Sadheo
    08/16/2018 at 11:00 am

    Thank you so so much!

    #appreciate

Post a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Read previous post:
Manage Shared Mailbox by using PowerShell | Office 365

In the current article, we review how to implement common management tasks of Exchange Shared mailboxes using PowerShell. PowerShell |...

Close