Data Protection Issues

How to Encrypt Exchange Online Email When Subject Starts with a Tag

Elise WilliamsElise Williams Nov 2, 2026 869 views

Question details

The user needs to set up a mail flow rule that applies encryption to an email only if its subject line starts with a specific tag, avoiding false positives.

How to Encrypt Exchange Online Email When Subject Starts with a Tag
Product
Exchange Online
Device & OS
not provided
Scenario
Configuring automated Office 365 Message Encryption based on specific subject line formatting.
Observed behavior
Standard 'subject includes' rules match the tag even if it appears in the middle of the subject line, which triggers encryption incorrectly.
Before you start

Ensure you have Exchange Administrator permissions in your Microsoft 365 tenant to access and modify mail flow rules in the Exchange Admin Center.

Solution 1Recommended

Configure Mail Flow Rule with a Regular Expression

Use a regular expression in your mail flow rule to ensure the tag is only matched at the very beginning of the subject line.

The Exchange Admin Center allows you to use regular expressions for precise string matching. By using the caret character (^), you can specify that the tag must appear exactly at the start of the subject line to trigger the encryption.

1
Access Exchange Admin Center

Log in to the Microsoft 365 Exchange admin center using your administrator credentials.

2
Navigate to Rules

Go to 'Mail flow' in the left-hand menu and select 'Rules'.

3
Create a New Encryption Rule

Click 'Add a rule' and choose 'Apply Office 365 Message Encryption and rights protection to messages' from the template list.

4
Set the Condition

In the 'Apply this rule if' section, select 'The subject or body matches these text patterns'.

5
Enter the Regular Expression

Enter a regular expression like ^[zip] to strictly match subjects starting with your tag, then save the rule.

Configure Mail Flow Rule with a Regular Expression
Syntax Note: The caret (^) symbol denotes the start of a string in regular expressions. You may need to escape special characters depending on your exact tag format.
Free Microsoft Office alternative

Try WPS Office for Seamless Document Management

While Exchange Online handles your server routing and email encryption, WPS Office provides a lightweight, highly compatible desktop suite for opening, editing, and protecting the actual documents you attach to those secured emails.

  1. 1. Download the Installer: Visit the official WPS Office website and download the free installation package.
  2. 2. Install the Software: Run the installer and follow the quick on-screen setup instructions.
  3. 3. Open and Protect Documents: Open your files, edit them seamlessly, and apply document-level passwords before emailing.
Fully compatible with Microsoft Word, Excel, and PowerPoint document formats.Built-in document encryption and password protection features for sensitive attachments.Free, lightweight, and incredibly fast to install and launch.Familiar user interface requiring no learning curve for Microsoft Office users.
QA img-9

Frequently Asked Questions

Why does my encryption rule trigger when the tag is in the middle of the subject?

This happens if the rule uses a 'subject includes' condition, which scans for the specified text string anywhere in the subject line. To fix this, you must use a regular expression starting with a caret symbol (^) or a strict 'starts with' condition to enforce matching only at the beginning.

Can I also trigger Exchange email encryption based on tags in the email body?

Yes, Exchange mail flow rules allow you to set conditions based on 'The subject or body includes any of these words.' This will trigger the designated encryption if the tag is found in either the subject line or the body text of the message.

Does applying Office 365 Message Encryption require a specific license?

Yes, utilizing Office 365 Message Encryption (OME) requires a Microsoft 365 subscription that includes Azure Information Protection Plan 1 or Microsoft 365 Business Premium, E3, or E5 licenses.