The below should help you out, fix as you will!
If you find this helpful, please mark it as the answer, Regards Bz
#Get all Ad users
$users = Get-ADUser -Filter * -Properties EmailAddress, proxyAddresses
#loop through each user
foreach ($user in $users) {
$newAlias = $user.EmailAddress -replace '@domain1.com', '@domain2.com'
# Update the proxyAddresses attribute
Set-ADUser $user -Add @{proxyAddresses = "smtp:$newAlias"}
}
# Check the updated proxyAddresses for a specific user
(Get-ADUser -Identity 'User1' -Properties proxyAddresses).proxyAddresses
#Sync up with Azure AD
Start-ADSyncSyncCycle -PolicyType Delta