Scenario
After completing the initial Exclaimer connector setup, you notice that users’ email addresses are no longer displaying their usual domain. Instead, they have been replaced with the default .onmicrosoft.com domain associated with your Microsoft 365 subscription.
Reason
Unexpected changes to user email addresses reverting to the .onmicrosoft.com domain may stem from several configuration or synchronization factors across hybrid, cloud, or directory-sync environments.
- Hybrid Setup Problems
If you use both Microsoft 365 and an on-premises Exchange server, any recent changes or synchronization issues can cause Microsoft 365 to switch email addresses back to .onmicrosoft.com. - Microsoft Entra Connect Not Set Up Correctly
If Microsoft Entra Connect (formerly Azure AD Connect) is not configured properly, especially the proxyAddresses field in your local Active Directory, then email addresses can be changed during synchronization. - Third-Party Connector Setup
When setting up third-party connectors, if the proxyAddresses attribute is not filled in correctly, Microsoft 365 may create or update emails using .onmicrosoft.com by default. - Verified Domain Changes Triggering ProxyCalc
When a verified domain is modified, it can trigger ProxyCalc—a backend process that ensures UserPrincipalName and proxy addresses remain aligned in Azure AD. Significant changes, such as updating a verified domain, may therefore result in automatic updates to email addresses. - Cloud-Only Setup Misconfiguration
In a fully cloud setup, if your custom domain isn’t set as the default domain, Microsoft 365 may assign new or updated email addresses with .onmicrosoft.com. - Special or Disabled Mailboxes
Some mailbox types—or disabled accounts—may get .onmicrosoft.com addresses if their SMTP settings are missing or incomplete in Entra ID.
Resolution
The following solutions can be used to correct the proxy address issue and reset affected email addresses. For additional guidance, Microsoft recommends contacting their support team:
• Domain Administrative Permissions
To check user proxy addresses:
- On a server or computer with Active Directory Users and Computers (ADUC) installed, open the ADUC console. ADUC is typically available on domain controllers or computers with Remote Server Administration Tools (RSAT) installed.
- In the ADUC console, navigate to the View menu and ensure that the Advanced Features has been selected. This allows access to additional user properties, including the Attribute Editor tab.
- Navigate through the directory tree to find the user account. Alternatively, use the search function to quickly locate the user.
- Right-click the user account and select Properties. If the tab is missing, confirm that Advanced Features is enabled (see step 2).
- Scroll down the list of attributes until you find the proxyAddresses attribute. This attribute lists all the email addresses associated with the user account, including the primary SMTP address (denoted as SMTP in uppercase) and any secondary SMTP addresses (denoted as smtp in lowercase).
- Verify that the user’s primary email address is correctly listed with the company domain. Review any secondary addresses, such as aliases, to confirm if they are valid.
If you need to update the proxyAddresses for multiple users in Active Directory, you can use PowerShell to automate the process. This method ensures that all users have their email addresses correctly configured, which is especially useful for bulk updates.
The proxyAddresses need to be populated with the relevant SMTP addresses for the users.
• Domain Administrative Permissions
• PowerShell module in Active Directory
To update proxy addresses for all users using PowerShell
- Launch PowerShell as an administrator to ensure you have the necessary permissions to modify user attributes across the Active Directory.
Manually import the Active Directory module by running the following command:
Import-Module ActiveDirectory- Determine the pattern for the new proxy addresses. Typically, this involves using the user's username or another attribute to construct their email address consistently, such as 'SMTP:username@yourdomain.com' for the primary address and "smtp:alias@yourdomain.com" for any aliases.
Use Get-ADUser to retrieve the user accounts that require updates. You can filter users based on specific criteria, such as department or location, if necessary. The following example retrieves all user accounts:
$users = Get-ADUser -Filter * -Properties proxyAddressesLoop through each user account and update the proxyAddresses attribute according to your organization's email address policies. The following script sets a new primary SMTP address for each user based on their samAccountName. Adjust the pattern as needed for your organization:
foreach ($user in $users) {
$newPrimaryAddress = "SMTP:" + $user.samAccountName + "@yourdomain.com"
$newAliasAddress = "smtp:alias." + $user.samAccountName + "@yourdomain.com"
Set-ADUser -Identity $user -Replace @{proxyAddresses=@($newPrimaryAddress, $newAliasAddress)}
}
This script constructs a new primary SMTP address and an alias for each user, then updates the proxyAddresses attribute with these values. Modify the $newPrimaryAddress and $newAliasAddress patterns as necessary to fit your email address schema.
After applying the changes, it's prudent to verify that the proxy addresses have been updated correctly. Select a few user accounts at random, and use the command from the initial verification step to check the updated values:
Get-ADUser -Identity username -Properties proxyAddresses | Select-Object -ExpandProperty proxyAddressesReplace username with the actual username of the account you wish to check.
• Administrative privileges in your Microsoft 365 environment
• PowerShell module for Exchange Online Management is installed on your system
To reset email addresses to the original domain in Microsoft 365 using PowerShell:
Open a new PowerShell session as an administrator and connect to Exchange Online with:
Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.comEnter your admin credentials when prompted.
Review all mailboxes before making any changes. To retrieve and store all mailbox users:
$mailboxes = Get-Mailbox -ResultSize UnlimitedLoop through each mailbox and set the primary SMTP address back to the original domain. Ensure the domain part is correctly set to your organization's domain.
foreach ($mailbox in $mailboxes){
$newPrimarySmtp = $mailbox.UserPrincipalName.Replace("@onmicrosoft.com", "@yourdomain.com")
Set-Mailbox -Identity $mailbox.Identity -PrimarySmtpAddress $newPrimarySmtp -EmailAddressPolicyEnabled $false
}
This script changes the primary SMTP address for each mailbox, moving away from the @onmicrosoft.com domain to @yourdomain.com. The -EmailAddressPolicyEnabled $false parameter is used to ensure that the email address change is not overwritten by email address policies.
After updating the email addresses, it's a good practice to verify that the changes have been correctly applied. Select a few mailboxes at random and use the Get-Mailbox cmdlet to check the primary SMTP address:
Get-Mailbox -Identity username | Select-Object DisplayName, PrimarySmtpAddress
Replace username with the actual username of the mailbox you wish to check.