Skip to content

Change Microsoft 365 primary SMTP address

A licensed mailbox can have multiple email addresses, but each mailbox has only one primary SMTP address. You can change the name and domain of your primary SMTP address for single and multiple mailboxes. In this article, you will learn how to change the primary SMTP address in Microsoft 365 admin center and PowerShell.

Change primary SMTP address in Microsoft 365 admin center

You can recognize the primary address for each user because SMTP (Simple Mail Transfer Protocol) is written in capital letters. The alias addresses are spelled with small letters (smtp).

We will show you how to change the primary SMTP address in the Microsoft 365 admin center:

  • Single mailbox
  • Multiple mailboxes

You can change the primary address name and domain for a single mailbox. It’s only possible to bulk change the primary email address domain for all users in the Microsoft 365 admin center.

Note: You can only change the primary email address of mailboxes with a Microsoft 365 license.

Change user primary SMTP address

Some users have a different username (UserPrincipalName) than their primary address. So, when you change their primary address, it will not change the username. However, Microsoft recommends having the person’s logon UPN match their primary SMTP address.

There are several email address types, but every mailbox must have one primary SMTP address. In our example, we want to change the primary SMTP email address of the user Brenda Smith.

Follow these steps to change the primary SMTP email address in the Microsoft 365 admin center:

  1. Sign in to Microsoft 365 admin center
  2. Click Show All
Change primary SMTP address in Microsoft 365 admin center
  1. Click Settings > Domains
  2. Click on a domain
Change primary SMTP address in Microsoft 365 admin center
  1. Click Users tab
  2. Search and Click on a user (Brenda.Smith@m365info.com)
Change primary SMTP address in Microsoft 365 admin center user
  1. Under Account tab
  2. Click Manage username and email
Manage username and email
  1. Click edit icon
Primary email address and username
  1. Type Username
  2. Select other domain (optional)
  3. Click Done
Change primary email address and domain for single user
  1. Click Save changes
Save changes new primary email address
  1. Primary email address changes saved successfully

You successfully updated the primary SMTP email address for a user in the Microsoft 365 admin center. The old primary address will automatically become an alias, which you can remove anytime.

Note: If the primary email is also the username, it will automatically change both the primary email and username.

See the next step if you want to change the primary address domain of all users.

Bulk change users primary address domain

If you want to switch multiple users to another domain, you can do this in Microsoft 365 admin center.

To bulk change users primary address domain, follow these steps:

  1. Sign in to Microsoft 365 admin center
  2. Click Settings > Domains
  3. Click on a domain
Bulk change users primary address domain
  1. Click Users tab
  2. Select multiple users
  3. Click Change domain
Bulk change users primary address domain
  1. Select a domain
  2. Click Save
Bulk change users primary address domain
  1. It saved the changes of the primary address domain of multiple users to m365info.com

The old primary address of each mailbox will automatically become an alias.

Note: After you change the domain for multiple users, you need to let the users know to sign in to Microsoft services with their new domain, as the old username won’t work.

If you want to bulk change the primary address name and domain, use PowerShell in the next step

Change primary address with Exchange Online PowerShell

We will show you how to change the primary SMTP address with PowerShell using different methods.

Connect Exchange Online PowerShell

To be able to run PowerShell commands, you must Connect to Exchange Online PowerShell. Open Windows PowerShell as administrator, run the below cmdlet and sign in with your admin credentials.

Connect-ExchangeOnline

Bulk change primary SMTP address

If you want to change the primary SMTP address for multiple users, it’s best to use a CSV file.

Create a CSV file to replace the primary SMTP address with the below steps:

  1. Open Microsoft Excel
  2. Type User at the top of the first column
  3. List the user principal names
  4. Type Emailaddress at the top of the second column
  5. List the new SMTP primary address

Note: When you change the primary email address of the user to another domain, the new domain that you like to add should be included in the Microsoft 365 list of Trusted Domains.

See an example of the CSV file.

Change Microsoft 365 primary SMTP address CSV file
  1. Name the file SMTPaddress and save it as a CSV file
  2. Create a temp folder in the (C:) drive if you don’t have one
  3. Save the SMTPaddress.csv file in the temp folder
Save SMTPaddress CSV file in C:\temp folder
  1. To ensure PowerShell can read the file, run the Import-Csv cmdlet
Import-Csv "C:\temp\SMTPaddress.csv"

The PowerShell script will only change the primary SMTP for the users in the CSV file. It will also switch the old primary smtp address as an alias (smtp) and remove all other alias addresses if there are any.

  1. Run the below PowerShell script
$csv = Import-Csv "C:\temp\SMTPaddress.csv"

foreach ($line in $csv) {
    $SMTP = "SMTP:" + $line.Emailaddress
    try {
        Set-Mailbox -Identity $line.User -EmailAddresses $SMTP -WindowsEmailAddress $line.Emailaddress -ErrorAction Stop
        Write-Host "Updated email address for $($line.User) to $SMTP" -ForegroundColor Green
    }
    catch {
        Write-Host "Failed to update email address for $($line.User). Error: $($_.Exception.Message)" -ForegroundColor Red
    }
}
  1. The PowerShell output result is shown below (ignore the warnings)

It shows a warning for each email address because you only changed the primary SMTP address and not the username.

WARNING: Proxy address "B.Smith@ms365info.onmicrosoft.com" is used as WindowsLiveId. So it can't be removed from list of email addresses. To remove it, first change the WindowsLiveId.
Updated email address for B.Smith@ms365info.onmicrosoft.com to SMTP:Brenda.Smith@m365info.com
WARNING: Proxy address "Charles.Mitchel@m365info.com" is used as WindowsLiveId. So it can't be removed from list of email addresses. To remove it, first change the WindowsLiveId.
Updated email address for Charles.Mitchel@m365info.com to SMTP:Charles.Mitchel@ms365info.onmicrosoft.com
WARNING: Proxy address "Eric.Paige@m365info.com" is used as WindowsLiveId. So it can't be removed from list of email addresses. To remove it, first change the WindowsLiveId.
Updated email address for Eric.Paige@m365info.com to SMTP:E.Paige@m365info.com
WARNING: Proxy address "Julia.Wood@m365info.com" is used as WindowsLiveId. So it can't be removed from list of email addresses. To remove it, first change the WindowsLiveId.
Updated email address for Julia.Wood@m365info.com to SMTP:J.Wood@ms365info.onmicrosoft.com
WARNING: Proxy address "Susan.Brown@m365info.com" is used as WindowsLiveId. So it can't be removed from list of email addresses. To remove it, first change the WindowsLiveId.
Updated email address for Susan.Brown@m365info.com to SMTP:Susan.Brown@ms365info.onmicrosoft.com

In our example, the SMTP primary address changed from B.Smith@ms365info.onmicrosoft.com to Brenda.Smith@m365info.com.

  • The other email address types (e.g. alias) of the same user will be removed
  • The old primary address (B.Smith@ms365info.onmicrosoft.com) will become an alias
  • The username stays the same (B.Smith@ms365info.onmicrosoft.com)
Change Microsoft 365 primary SMTP address in bulk

Bulk change primary SMTP address and username

If you want to change the primary SMTP address and smtp address for multiple users, you need to create a new CSV file with two columns.

Follow the below steps to create a CSV file to replace the primary SMTP address:

  1. Open Microsoft Excel
  2. Type User at the top of the first column
  3. List the user principal names
  4. Type Emailaddress at the top of the second column
  5. List the new SMTP primary address

Note: When you change the primary email address of the user to another domain, the new domain that you like to add should be included in the Microsoft 365 list of Trusted Domains.

See an example of the CSV file.

Change Microsoft 365 primary SMTP address and alias CSV file
  1. Name the file SMTPaddress and save it as a CSV file
  2. Create a temp folder in the (C:) drive if you don’t have one
  3. Save the SMTPaddress.csv file in the temp folder
  4. To ensure PowerShell can read the file, run the Import-Csv cmdlet
Import-Csv "C:\temp\SMTPaddress.csv"

The PowerShell script will change the primary SMTP address and remove all alias addresses for each user in the CSV file.

  1. Run the below PowerShell script
$csv = Import-Csv "C:\temp\SMTPaddress.csv"

foreach ($line in $csv) {
    $SMTP = "SMTP:" + $line.Emailaddress
    try {
        Set-Mailbox -Identity $line.User -EmailAddresses $SMTP -WindowsEmailAddress $line.Emailaddress -MicrosoftOnlineServicesID $line.Emailaddress -ErrorAction Stop
        Write-Host "Updated email address for $($line.User) to $SMTP" -ForegroundColor Green
    }
    catch {
        Write-Host "Failed to update email address for $($line.User). Error: $($_.Exception.Message)" -ForegroundColor Red
    }
}
  1. The PowerShell output is shown below (ignore the warnings)

The user will only have one primary SMTP address, which is also their username.

WARNING: UserPrincipalName "B.Smith@ms365info.onmicrosoft.com" should be same as WindowsLiveID "Brenda.Smith@m365info.com", UserPrincipalName should remain as"Brenda.Smith@m365info.com".
Updated email address for Brenda.Smith@m365info.com to SMTP:Brenda.Smith@m365info.com
WARNING: UserPrincipalName "Charles.Mitchel@m365info.com" should be same as WindowsLiveID "C.Mitchel@m365info.com", UserPrincipalName should remain as"C.Mitchel@m365info.com".
Updated email address for Charles.Mitchel@ms365info.onmicrosoft.com to SMTP:C.Mitchel@m365info.com
WARNING: UserPrincipalName "Gordon.Payne@m365info.com" should be same as WindowsLiveID "G.Payne@ms365info.onmicrosoft.com", UserPrincipalName should remain as"G.Payne@ms365info.onmicrosoft.com".
Updated email address for Gordon.Payne@m365info.com to SMTP:G.Payne@ms365info.onmicrosoft.com
WARNING: UserPrincipalName "Rebecca.Long@m365info.com" should be same as WindowsLiveID "R.Long@ms365info.onmicrosoft.com", UserPrincipalName should remain as"R.Long@ms365info.onmicrosoft.com".
Updated email address for Rebecca.Long@m365info.com to SMTP:R.Long@ms365info.onmicrosoft.com
WARNING: UserPrincipalName "Susan.Brown@m365info.com" should be same as WindowsLiveID "Susan.Brown@m365info.com", UserPrincipalName should remain as"Susan.Brown@m365info.com".
Updated email address for Susan.Brown@ms365info.onmicrosoft.com to SMTP:Susan.Brown@m365info.com
WARNING: UserPrincipalName "Thomas.Lee@m365info.com" should be same as WindowsLiveID "Thomas.Lee@ms365info.onmicrosoft.com", UserPrincipalName should remain as"Thomas.Lee@ms365info.onmicrosoft.com".
Updated email address for Thomas.Lee@m365info.com to SMTP:Thomas.Lee@ms365info.onmicrosoft.com

The primary SMTP address and username (UserPrincipalName) both changed to the same email address you provided in the CSV file.

In our example, the primary SMTP address and username changed to Brenda.Smith@m365info.com. It also removed all the alias addresses.

Bulk change Microsoft 365 primary SMTP address and username

Bulk change primary SMTP address and username and add alias address

We will bulk change the users primary SMTP address and username, and change the old primary address into an alias.

Follow the below steps to create a CSV file to replace the primary address and username:

  1. Open Microsoft Excel
  2. Type User at the top of the first column
  3. List the user principal names
  4. Type Emailaddress at the top of the second column
  5. List the new SMTP primary address

Note: When you change the primary email address of the user to another domain, the new domain that you like to add should be included in the Microsoft 365 list of Trusted Domains.

See an example of the CSV file.

Change Microsoft 365 primary SMTP address plus adds SIP address CSV file
  1. Name the file SMTPaddress and save it as a CSV file
  2. Create a temp folder in the (C:) drive if you don’t have one
  3. Save the SMTPaddress.csv file in the temp folder
  4. To ensure PowerShell can read the file, run the Import-Csv cmdlet
Import-Csv "C:\temp\SMTPaddress.csv"

The PowerShell script will change the primary SMTP address and username with the new email address in the CSV file for each user. The old primary SMTP address will become an alias address and all other alias addresses will be removed.

  1. Run the below PowerShell script
$csv = Import-Csv "C:\temp\SMTPaddress.csv"

foreach ($line in $csv) {
    $Mailbox = Get-Mailbox -Identity $line.User
    $Primarymail = $Mailbox.PrimarySmtpAddress
    $SMTP = "SMTP:" + $line.Emailaddress
    try {
        Set-Mailbox -Identity $line.User -EmailAddresses $SMTP, $Primarymail -WindowsEmailAddress $line.Emailaddress -MicrosoftOnlineServicesID $line.Emailaddress -ErrorAction Stop
        Write-Host "Updated email address for $($line.User) to $SMTP" -ForegroundColor Green
    }
    catch {
        Write-Host "Failed to update email address for $($line.User). Error: $($_.Exception.Message)" -ForegroundColor Red
    }
}
  1. See the PowerShell output result (ignore the warnings)
WARNING: UserPrincipalName "Brenda.Smith@m365info.com" should be same as WindowsLiveID "Brenda.SmithNEW@m365info.com", UserPrincipalName should remain as"Brenda.SmithNEW@m365info.com".
Updated email address for Brenda.Smith@m365info.com to SMTP:Brenda.SmithNEW@m365info.com
WARNING: UserPrincipalName "C.Mitchel@m365info.com" should be same as WindowsLiveID "Charles.Mitchel@m365info.com", UserPrincipalName should remain as"Charles.Mitchel@m365info.com".
Updated email address for C.Mitchel@m365info.com to SMTP:Charles.Mitchel@m365info.com
WARNING: UserPrincipalName "Chris.Lucas@m365info.com" should be same as WindowsLiveID "Chris.Lucas@ms365info.onmicrosoft.com", UserPrincipalName should remain as"Chris.Lucas@ms365info.onmicrosoft.com".
Updated email address for Chris.Lucas@m365info.com to SMTP:Chris.Lucas@ms365info.onmicrosoft.com
WARNING: UserPrincipalName "Mary.James@m365info.com" should be same as WindowsLiveID "Mary.James@ms365info.onmicrosoft.com", UserPrincipalName should remain as"Mary.James@ms365info.onmicrosoft.com".
Updated email address for Mary.James@m365info.com to SMTP:Mary.James@ms365info.onmicrosoft.com
WARNING: UserPrincipalName "Susan.Brown@m365info.com" should be same as WindowsLiveID "S.Brown@ms365info.onmicrosoft.com", UserPrincipalName should remain as"S.Brown@ms365info.onmicrosoft.com".
Updated email address for Susan.Brown@m365info.com to SMTP:S.Brown@ms365info.onmicrosoft.com

In our example, the user Brenda Smith will get the same primary SMTP address and username you provided in the CSV file. The old primary address will become an smtp alias address.

  • The primary SMTP address changes to Brenda.SmithNEW@m365info.com
  • The username also changed to brenda.smithnew@m365info.com
  • The old primary address (Brenda.Smith@m365info.com) will become an alias (smtp)
  • All other email address types (e.g., alias) of the same user will be removed
Bulk change Microsoft 365 primary SMTP address with username and add alias

Verify primary SMTP address changed

You can also verify your results with the Get-Mailbox PowerShell cmdlet.

Get-Mailbox "Brenda.SmithNEW@m365info.com" | fl EmailAddresses,WindowsEmailAddress,WindowsLiveID

It shows all the email addresses the user has.

PS C:\> Get-Mailbox "Brenda.SmithNEW@m365info.com" | fl EmailAddresses,WindowsEmailAddress,WindowsLiveID


EmailAddresses      : {SPO:SPO_f9597960-a632-4b2e-b40a-7ad69de10706@SPO_a2ff010e-0e03-4c56-8863-2ae7f07876dd, 
                      SIP:brenda.smithnew@m365info.com, smtp:Brenda.Smith@m365info.com, 
                      SMTP:Brenda.SmithNEW@m365info.com}
WindowsEmailAddress : Brenda.SmithNEW@m365info.com
WindowsLiveID       : Brenda.SmithNEW@m365info.com

That’s it!

Read more: Export Microsoft 365 mailbox to PST file »

Conclusion

You learned how to change the primary SMTP address in the Microsoft 365 admin center and with PowerShell. If you want to bulk change the primary address name and domain for all users, you must create a CSV file and run the PowerShell script.

Did you enjoy this article? You may also like Export Microsoft 365 users licences. Don’t forget to follow us and share this article.

o365info Team

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has 0 Comments

Leave a Reply

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