A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
Based on my research and testing, Exchange Online can add an organization-wide disclaimer to messages by using a mail flow rule. The disclaimer can also use supported sender attribute placeholders, such as %%DisplayName%%, %%FirstName%%, %%LastName%%, %%UserPrincipalName%%, and %%WindowsEmailAddress%%.
However, these disclaimer placeholders only insert the corresponding attribute values and do not perform string manipulation. For example, using %%******@newdomain.com would not remove the existing domain and replace it with the new domain. Instead, it would result in an incorrect value such as ******@******@newdomain.com.
As one possible approach, I tested using Exchange Online PowerShell together with a mailbox custom attribute.
First, retrieve the user mailboxes and specify the new domain:
$mailboxes = Get-EXOMailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited
$newDomain = "newdomain.com"
Then, calculate the future email address for each mailbox by keeping the existing local part and replacing the domain:
$mailboxes | ForEach-Object {
$currentEmail = $_.PrimarySmtpAddress.ToString()
$localPart = $currentEmail.Split("@")[0]
$futureEmail = "$localPart@$newDomain"
Set-Mailbox -Identity $_.UserPrincipalName -CustomAttribute1 $futureEmail
}
In this approach, CustomAttribute1 is used to store the future email address for each mailbox. Exchange Online supports custom mailbox attributes and allows them to be managed using Set-Mailbox.
Mail flow rule conditions and exceptions (predicates) in Exchange Online | Microsoft Learn
I then configured a single mail flow rule to append the disclaimer. During testing, the same rule displayed a different future email address based on the sender. For example:
- User A > ******@newdomain.com
- User M > ******@newdomain.com
- User C > ******@newdomain.com
Based on my testing, a separate mail flow rule was not required for each user. The future email address was prepared and stored per mailbox, while a single mail flow rule handled the disclaimer rendering.
If the disclaimer should be applied to all outgoing messages regardless of the recipient, the rule can be configured to apply to all messages. If the disclaimer should only be added to messages sent outside the organization, the rule can instead use the recipient condition outside the organization.
Note: The use of %%CustomAttribute1%% in the disclaimer above is based on testing performed in my test tenant. Microsoft documentation confirms that CustomAttribute1 through CustomAttribute15 are supported custom mailbox attributes that can be managed in Exchange Online. However, I have not found Microsoft documentation that explicitly lists %%CustomAttribute1%% as a supported disclaimer placeholder. Therefore, I recommend validating this behavior in your own environment before deploying it broadly.
I hope this information helps.
If the answer is helpful, please click "Yes". If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in the forum documentation to enable e-mail notifications if you want to receive the related email notification for this thread.