Remove sensitive content

Remove Sensitive Content action in CodeTwo Exchange Rules PRO is used to automatically filter confidential data and sensitive content in messages, using the phrases defined within the program's dictionary.

Each phrase used in the dictionary has its own score. On the other hand, each dictionary (collection of phrases) has a required cumulative score. Once the action is configured, the program searches for the selected phrases in the content of the message and thereafter, compares score of all found phrases with the required cumulative score of corresponding dictionary. Finally, if the cumulative score is reached then the action is triggered.

The diagram below (Fig. 1.) shows how the Remove Sensitive Content action is processed by the program:

ER Pro 2.x - Remove sensitive content big.
Fig. 1. The diagram showing how the Remove Sensitive Content action is processed by the program.

The program, having deployed this action, will remove, mask or replace the sensitive content in messages that meet the criteria defined in Conditions.

Example of usage

This action may be used in companies who are aware of the danger entailed in letting users use corporate email without any restrictions. As some messages may contain unwanted content belonging to categories such as Gambling or Finances, it is practically impossible to supervise all mail in the company manually. With CodeTwo Exchange Rules PRO, you can define the Remove sensitive content action that will remove the unwanted content automatically from the messages that travel through Exchange if they meet the defined criteria. 

How to configure this action 

To activate the action click Add in the Actions tab and select Remove sensitive content (Fig. 2.). 

Fig. 2. Choosing Remove Sensitive content action from the Actions tab.

A new action Remove sensitive content will appear in the list of actions pane while the right pane will show the action's properties (Fig. 3.). 

Fig. 3. Remove sensitive content action's properties.

The first thing you need to do is to specify how the action should process the sensitive content once it is found within a message (Fig. 4.). The choice is between:

  • Removing the content - when the phrase is found it is being removed from the message content
  • Masking the content - when the phrase is found it is being masked with **** , e.g. f***
  • Replacing the content - when the phrase is found it will be replaced with another chosen phrase, e.g. [replaced]
Fig. 4. Choice of actions taken upon the found sensitive content.

The second important aspect is the definition of phrases that will be searched for within the content of messages. The phrases can be selected on the properties pane that holds the available categories (dictionaries). Select the dictionary of your choice by checking the box next to it. Next, set the required cumulative score for a given dictionary if necessary (Fig. 5.).

Fig. 5. Changing the cumulative score of the dictionary / category.

If the score of all phrases found in the message reaches the required cumulative score of the associated dictionary, CodeTwo Exchange Rules PRO will take the action upon the message. Note that the predefined phrases in the particular categories have their score set by default. On the other hand, if you add a new phrase you need to set its score manually. Either way, you may adjust each score at any time according to your needs.


Note that in when one particular phrase appears more than one time within the message, it will be counted only once while summing up the score of phrases and comparing it with the corresponding cumulative score of the dictionary.

There are four (exceptions apply*) types of phrases that can be searched for while the program processes messages:

  • Exact phrase - this type of sensitive content defines that the program should search for the exact match of the chosen phrase, e.g. "test". If the message contains the defined phrase ("test") then the program applies the action. If however there is no match (e.g. there is the word "tester" used in message content) the program simply ignores it and no action is taken. The search is performed case-insensitively.
  • Wildcard - this type of sensitive content defines that the program should search for the phrase that matches or contains the selected phrase, e.g. "test*". If the message contains the word "test" or any other word containing it e.g. "tester" the rule is being applied, consequently the action is triggered. Note that wildcards may be used only at the beginning or the end of a selected phrase, e.g. *test, test*. The search is performed case-insensitively.
  • Regular expression - it defines a sequence of characters that forms a search pattern of phrases in messages. The search is performed case-insensitively as well. CodeTwo Exchange Rules Pro supports the standard Microsoft's .NET type of regular expressions. Learn more about regular expressions
  • *Algorithm - this type of sensitive content is based on the Luhn algorithm and can be used while configuring the program to search for the properly entered credit card numbers within the body of messages. Furthermore, it can be used for credit cards' numbers only and managed in the Credit Card dictionary (Fig. 6.). At the moment, by default the program can recognize credit cards numbers issued by the following providers:
    • Visa
    • MasterCard
    • American Express
    • Maestro
    • Diners Club
    • Discover
    • JCB
    If, however, you want the program to recognize numbers of other credit cards' providers then listed above, you need to define them in the Credit Cards category using the regular expression type of phrase.


    The algorithm type of sensitive content will only be resolved when the credit card number in the message is entered correctly (compatible with the pattern defined by a credit card provider) and is preceded and followed by a white space or any other character different than a number, a letter or a plus sign (+). 

    A correct credit card number which is entered in the message body but it is preceded, followed or both preceded and followed by a letter(-s), a number(-s) or plus(-es) will not be recognized as the correct credit card number. What is more, only the following separators are accepted: dots (.), dashes (-) and white space (except for end of line characters). If any other characters are found within the credit card number, it is not considered as a valid occurrence.

Fig. 6. Using the credit card number algorithm.


Please note that in specific situations, some strings of numbers may be recognized as the proper credit card numbers although they are not. Furthermore, such situation may take place in regards to, e.g. personal name records (PNR) in the database of a computer reservation system (CRS) or the technical parameters of devices.

To check / set the exact score of phrases in a given dictionary, add / remove new categories or edit / add / remove phrases from a given category click Edit categories (Fig. 7.).

Fig. 7. Opening categories / dictionary editor.

The window that opens shows the predefined categories containing sensitive content. By selecting the dictionary on the left, you can modify it by adding (Fig. 8.), deleting and editing its phrases (Fig. 9.).

Fig. 8. Adding new phrase to the chosen category.
Fig. 9. Editing phrase from the chosen category.

Additionally, you can also create new categories and remove the already existing ones (Fig. 10.).

Fig. 10. Creating a new category.

After you select the dictionary and define the phrases, confirm the changes by clicking OK. Once you click the Submit changes button in the ribbon of the Administration Panel, CodeTwo Exchange Rules PRO will take the defined action upon the sensitive phrases from all messages that meet the criteria defined in Conditions.

Was this information useful?