Summary
Add multiple SMTP proxy addresses to contact objects in office 365. Assuming cloud governance defines managing objects through the public cloud portal.
The Problem
The Office 365 admin panel is limited in only allowing the admin to add a single email address to a mail contact. If you want to add multiple addresses, you have to use PowerShell.
Steps: Add Multiple Email Addresses to Mail Contacts
Use the following set of commands to add and verify the additional proxy addresses.
- To connect PowerShell to Office 365, open the PowerShell console
- Type the following command: $Cred = Get-Credential
- Enter the username / password of a valid O365 admin account
- Type the following command: $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic –AllowRedirection
- Type the following command: Import-PSSession $Session
- Powershell is now attached to Office 365 Exchange and we can run the command to add addresses to the mail contact. Note that the primary address should have uppercase “SMTP:” prepended (there can be only one uppercase entry for the primary address. Additional secondary addresses must have lowercase otherwise there will be mail flow problems.)
- Set-MailContact “User Name” -EmailAddresses “SMTP:primary.email@domain.com”,”smtp:secondary.email@domain.com”
Code
[powershell]
$Cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic –AllowRedirection
Import-PSSession $Session
Set-MailContact “User Name” -EmailAddresses “SMTP:primary.email@domain.com”,”smtp:secondary.email@domain.com”
[/powershell]
Confirmation
To confirm this has worked run the following command:
- Get-MailContact “User Name” | select -ExpandProperty EmailAddresses
- Check the admin web interface and check the external email address is correct. This is the address receiving all incoming email for the contact.
References
- How to update contact information in Exchange Online in Office 365
- Bulk import external contacts to Exchange Online
Leave a Reply
Want to join the discussion?Feel free to contribute!
What if targeted smtp address already used by another Mailcontact.
Thanks for this page!
A couple things from a bit of a noob:
1) There’s no date on this page so not sure how current it is? (microsoft changes things soooo often, right?)
2) Would it be better to use primaryemail@domain.com and secondaryemail@domain.com? Or an example? I kept the primary. and secondary. text, substituting only email@domain.com but then thought that wasn’t right : )
Oh, and should the 2 addresses be visible in the admin panel? Or just the primary? If someone set up a secondary email for a contact like this, then months later, there’s troubleshooting about that secondary email address – somoene going into the exchange admin panel won’t know (won’t think?) to use powershell to see if there’s a 2nd email address for that contact.
NOT that it’s anything you can control… just MS being a nuisance : )