Microsoft Exchange – Forwarding Mail To External Email Addresses

KB ID 0001350 Dtd 05/10/17

Problem

Note: Below I’m using Exchange 2016, but the same approach will work for previous versions.

There are a load of reasons why you might want to do this, but before you go off in this direction consider why you are doing this in the first place. For example, if the user requesting this does not need an Exchange mailbox, i.e. because they only use their Gmail account then it’s probably a better idea to make them a mail-user. (That’s an AD user account, that has an external mailbox, and does not have an Exchange mailbox). For staff e.g. external contractors, part time staff, holiday cover staff, Mail-users might be a better fit.

If you are still reading you have a user with an Exchange mailbox, and you want to forward their email to an Email address outside your organisation, there are many ways of enabling forwarding, but fundamentally there’s only two things to consider;

  1. Do you still want mail to get delivered to their Exchange mailbox while forwarding?
  2. What is the external Email address you want to forward to?

Armed with this information you can decide what approach you want to take to achieve this.

 

Solution

Option 1: Get The User to Set Up Mail Forwarding in OWA

The best option for the lazy admin! “Oh, are you aware you can set this up yourself?” Even give them this URL as a walkthrough if you like 🙂

From within Outlook Web App open your ‘Options’

OWA Options 2016

Mail > Inbox and Sweep Rules > Inbox Rules > Add

Note: On older versions of OWA look in Organize email > inbox rules > Add.

OWA Inbox Rules

Give the rule a name > Set to [Apply to all messages] > Forward Redirect or Send > Forward Message To.

Note: Setting Redirect instead of Forward will NOT keep a copy in you local Exchange Mailbox.

OWA Forward Mail Rule

Enter the external email address to forward to > Save.

 OWA Forward Mail To External Address

OK.

2016 Forward Mail To External Address

Option 2: Enable Mail Forwarding In Exchange Admin Center

To forward mail externally for an ‘Exchange Mailbox User’, you need to create a ‘Contact’. A contact is an active directory object (not a user) that has an email address (in our case the external one). Log into Exchange Admin Center > Recipients > Contacts > Add > Mail Contact.

Exchange 2016 Forward Mail To External Address

Create a contact and give it a sensible name (so when it appears in the Global Address List it’s obvious what it is*)

*Note: You can hide them from the GAL if you like, with the following PowerShell;

Set-MailContact ALIAS-NAME -HiddenFromAddressListsEnabled $true

Exchange 2016 Mail contact

On the Mailbox Tab, locate the user you want to setup forwarding for, and edit them.

Mailbox Features > Scroll Down to ‘Mail Flow‘ > View Details > Tick ‘Enable Forwarding‘ > Browse to the CONTACT you created earlier > OK.

Note: You may also want to select “Deliver message to both forwarding address and mailbox”.

Exchange 2016 Enable Forwarding

Option 3: Setup Mailbox Forwarding With PowerShell

There’s a lot of rubbish written about this online, sites give you a line of PowerShell to paste in and it does not work, because there’s other things you need to do to make this work.

Example 1: Couldn’t find object “pete@externaldomain.com“. Please make sure that it was spelled correctly or specify a different.. 

If you setup mail forwarding using the ExternalEmailAddress you need to CREATE A CONTACT FIRST! Or you see the error above.

To Setup External Forwarding and Keep a Local Copy of the Email

Execute the following commands;

New-MailContact -Name Pete.Long-External -ExternalEmailAddress pete@externaldomain.com 
Set-Mailbox -Identity “Pete.Long” -DeliverToMailboxAndForward $true -ForwardingAddress pete@externaldomain.com 

Note: It’s the ‘$true‘ that maintains the local copy.

Exchange 2016 PowerShell Enable Forwarding

To Setup External Forwarding and Keep and NOT keep Local Copy of the Email

Execute the following commands;

New-MailContact -Name Pete.Long-External -ExternalEmailAddress pete@externaldomain.com 
Set-Mailbox -Identity “Pete.Long” -DeliverToMailboxAndForward $false -ForwardingAddress pete@externaldomain.com 

Note: It’s the ‘$false‘ that does not maintain the local copy.

Exchange 2016 PowerShell Enable Forward ALL

What about ExternalSMTPEmailAddress?

OK there’s another parameter you can set, it’s called ExternalSMTPAddress when you set this you DON’T NEED A CONTACT. This sounds great and again theres a load of blog posts that give you the PowerShell to set this for a user AND IT DOES NOT WORK!

Note: If you setup mail forwarding using this method the forwarding address is NOT VIEWABLE IN THE GUI, if you have enabled keep a local copy, that IS viewable.

Example 2 : My ExternalSMTPAddress Forwarder is not working?

This is because what other sites don’t tell you is unless you specified the target domain (for the remote email address), as AutoForwardEnabled it has a habit of not working! 

See Below to setup Mail forwarding with ExternalSMTPAddress properly.

To Setup External Forwarding and Keep a Local Copy of the Email

Execute the following commands;

Set-Mailbox -Identity “Pete.Long” -DeliverToMailboxAndForward $true -ForwardingSMTPAddress pete@externaldomain.com
New-RemoteDomain -Name ExternalDomain -DomainName externaldomain.com
Get-RemoteDomain ExternalDomain | Select DomainName, AutoForwardEnabled 

Note: It’s the ‘$true‘ that maintains the local copy.

Exchange 2016 PowerShell Enable Forwarding SMTP

To Setup External Forwarding and Keep and NOT keep Local Copy of the Email

Execute the following commands;

Set-Mailbox -Identity “Pete.Long” -DeliverToMailboxAndForward $false -ForwardingSMTPAddress pete@externaldomain.com 
New-RemoteDomain -Name ExternalDomain -DomainName externaldomain.com 
Get-RemoteDomain ExternalDomain | Select DomainName, AutoForwardEnabled  

Note: It’s the ‘$false‘ that does not maintain the local copy.

Exchange 2016 PowerShell Enable Forwarding SMTP ALL

Removing Mail Forwarding For a User

I wont insult your intelligence and tell you how to do this in the GUI just reverse engineer the above, but if you used ForwardingSMTPAddress you wont see it in the GUI! To remove ALL forwarding for a user, use the following command;

Set-Mailbox -Identity “Pete.Long” -DeliverToMailboxandforward $False -ForwardingSMTPAddress $Null -ForwardingAddress $Null

Showing Which User(s) Have Email Forwarding Enabled

Use the following commands;

Get-Mailbox | Where {$_.ForwardingAddress -ne $null} | Select Name, UserPrincipalName, ForwardingAddress, DeliverToMailboxAndForward
OR /AND
Get-Mailbox | Where {$_.ForwardingSMTPAddress -ne $null} | Select Name, UserPrincipalName, ForwardingAddress, ForwardingSMTPAddress, DeliverToMailboxAndForward

Show Email Forwarding for a Single User

Use the following command;

Get-Mailbox Pete.long | fl name,forwardingSMTPAddress,delivertomailboxandforward

 

Related Articles, References, Credits, or External Links

NA

Author: PeteLong

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *