Add or remove email addresses for a mailbox


There are times when we need to add additional proxy addresses to a mailbox, so the email is received when sent to alternate email address of the user.
In this post, we will learn how we can add additional proxy addresses to a mailbox using PowerShell.

EmailAddress property is a multivalued property hence we need to use the hash table operation.

Adding additional Email Address

  • Add a single email address

           Set-Mailbox "Sunil Chauhan" -EmailAddresses @{add="sunil@sunilchauhan.info"}

  • Add multiple email addresses

          Set-Mailbox "Sunil Chauhan" -EmailAddresses                                                                                        @{add="sunil@us.sunilchauhan.info","sunil@newdomain.com"}

  • Add Email addresses for multiple users

To add the addresses in the bulk, we first need to prepare a CSV file with the Mailbox Identity and the email address to be added.

Alias,EmailAddress 
ramc,ram@na.domain.com 
admin,admin@na.domain.com 
support,support@na.domain.com

Save the CSV file as Update-EmailAddress.csv.

Import-CSV "C:\Users\Administrator\Desktop\Update-EmailAddress.csv" | ForEach {Set-Mailbox $_.alias -EmailAddresses @{add=$_.EmailAddress}}

Removing EmailAddresses

  • Remove a single email address

          Set-Mailbox "Sunil Chauhan" -EmailAddresses @{remove="sunil@sunilchauhan.info"}

  • Remove multiple email addresses

          Set-Mailbox "Sunil Chauhan" -EmailAddresses                                                                                       @{remove="sunil@us.sunilchauhan.info","sunil@newdomain.com"}

  • Remove Email addresses from multiple users

To Remove the addresses in the bulk, we first need to prepare a CSV file with the Mailbox Identity and the email address to be added.

Alias,EmailAddress 
ramc,ram@na.domain.com 
admin,admin@na.domain.com 
support,support@na.domain.com

Save the CSV file as Update-EmailAddress.csv.

Import-CSV "C:\Users\Administrator\Desktop\Update-EmailAddress.csv" | ForEach {Set-Mailbox $_.alias -EmailAddresses @{remove=$_.EmailAddress}}

Comments