Hi @M4y4
Its recommended as the best practice to set both UPN and the SMTP(primarysmtpaddress) to the same address.
If you change the smtp address only, the impact is, the user will be able to receive and send emails from that address(@anotherdomain.com), but to login to his/her account(office365) they will need to use the old address(@e-mail.com) because its still the UserPrincipalName.
To set both primarySMTPAddress and UPN for the user to the same address at the same time use the PowerShell command below.
Install exchangeonlinemanagement module: Install-module -Name exchangeonlinemanagement
Then connect to exchangeonline PS, use connect-exchangeonline
Set-Mailbox -Identity <UPN> -WindowsEmailAddress <thenewaddress> -MicrosoftOnlineServicesID <thenewaddress>
After running this command, the old address will automatically be set as secondary smtp address, and added to the list of users emailaddresses.
Note: Changing only the primary SMTP address does not change the UPN.
To verify that it has worked
run this command.
Get-mailbox -identity <thenewaddress> | fl UserPrincipalName, primarySMTPAddress, EmailAddresses