
When you apply your company brand to customize the look of your organization’s email messages, you can also specify an expiration for these email messages. With Microsoft Purview Advanced Message Encryption, you can create multiple templates for encrypted emails that originate from your organization. Using a template, you can control how long recipients have access to mail sent by your users.
When an end user receives mail that has an expiration date set, the user sees the expiration date in the wrapper email. If a user tries to open an expired mail, an error appears in the OME portal.
You can only set expiration dates for emails to external recipients.
With Microsoft Purview Advanced Message Encryption, anytime you apply custom branding, Microsoft 365 applies the wrapper to email that fits the mail flow rule to which you apply the template. You can only use expiration if you use custom branding.
- Microsoft 365 E5 subscription
- Compliance Administrator Permissions
How to create a custom branding template to force mail expiration by using PowerShell
- Using a work or school account that has sufficient permissions in your organization, such as Compliance Administrator, start a Windows PowerShell session and connect to Exchange Online. For instructions, see Connect to Exchange Online PowerShell.
- Run the New-OMEConfiguration cmdlet

Where:
Identityis the name of the custom template.ExternalMailExpiryInDaysidentifies the number of days that recipients can keep mail before it expires. You can use any value between 1–730 days.