Powershell – How to create a forwarding account in office 365

exchange-2013microsoft-office-365powershell

I'm migrating our emails from one hosted exchange provider to another. How can I create addresses that simply forward to another (external) address but don't have a mailbox of their own?

Best Answer

If you want emails to an O365 organization forwarded to another, use a MailContact as outlined in Step 2 here: http://community.office365.com/en-us/wikis/exchange/how-to-forward-email-in-office-365.aspx

The gist of it:

$recAddress = "recipient@company.com"
$forwardToAddress = "recipient@newcompany.com"
$recipientName = "John The Moved User"

New-MailContact $recipientName –ExternalEmailAddress $forwardToAddress
$mailContact = Get-MailContact MailContactName
$mailContact.EmailAddresses.Add($recAddress)
Get-MailContact MailContactName | Set-MailContact -EmailAddresses $mailContact.EmailAddresses

Where $recAddress is the recipient specified in the email, $forwardToAddress is the address the email is forwarded to, and $recipientName is the name to use for the contact object.