How to remove keywords from the subject or body of replies on on-premises Exchange?

Note: CodeTwo Exchange Rules Pro is a server-side program that integrates with Exchange 2019 and 2016 or mixed environments that consist of any combination of the above-mentioned Exchange versions. In the first place, you can use it to centrally create and manage advanced HTML email signatures for all users, but also you can use it to control email flow in your organization – including removing keywords or entire phrases from the email subject line and the body. A full list of program features can be found here.

Remove keywords from email subject when replying externally

So let’s assume that you have created a rule, which adds a word [EXTERNAL] to the subject line of all incoming emails. The reason for that may be to warn employees that the email comes from an external user and they should be 100% sure before they open any attachments coming in with this email. If the sender is to be trusted and a user wants to reply to such a message then the word [EXTERNAL] should be removed from the email subject line before it reaches the recipient. And this is where CodeTwo solution comes in.

Keyword added to the subject line

To remove certain keywords from email subject on the server side, automatically, follow the steps below:

  1. Open the Administration Panel of CodeTwo Exchange Rules Pro and create a new rule using the Add button.
    Add a new rule in CodeTwo Exchange Rules ProImportant: If you don’t have CodeTwo Exchange Rules Pro running in your organization, you can try this setup out on a trial version. The trial version has all the functionalities of a licensed version and is valid for 30 days. Here you can download the program for testing purposes. It’s free.

  2. Name your rule and go to the Conditions tab.
  3. In the Conditions tab, set up the following conditions:
    1. Subject > contains keywords > [external]. When editing the keyword, make sure to select a checkbox next to Remove this keyword/phrase from email if found. Then, when the program finds the [external] keyword in the subject, it will remove it automatically.
    2. And > Message type > is > reply or forward.
    3. (Optional) And > Message direction > is > outgoing. This conditions is optional because if originally only incoming messages get the [external] tag, then when you reply, you reply externally.

    Set up a keyword to be removed from the email subject or body.

    Conditions to remove tags from replies

  4. (Optional) If you want to remove keywords also from the email body, or add another conditions to narrow down the scope of the rule, use the plus + icon. Use the And and Or operators to specify if the program needs to meet both conditions or just one of them. Use the Group button to group conditions.Two Additional conditions
  5. The Exceptions tab can stay as it is unless you want to exclude some emails or users from this rule.
  6. In the Actions tab, click the Add button and select the Remove keywords action.Add an action Add the Remove keywords action
  7. Then, add the keyword you specified in the Conditions tab – in this case, it is [external]. In the Remove from section, select Subject. If applies, you can also select Body and subject.
    Set up a keyword in the action
  8. Once the rule is ready to go on production, submit changes.
    Submit changes to remove keyword from email subject
  9. Now you can test the settings by replying to a message containing the [EXTERNAL] keyword in the subject.
    Keyword removed from reply

That’s it. Rules are set up and you have a very simple way to get rid of unwanted words and phrases from both email subject and body in replies and forwards.

Note that you can also use CodeTwo Exchange Rules Pro to do the first part of the task, which is to stamp external emails with the word [EXTERNAL]. This way, you would have both rules controlled via the program’s Administration Panel saving you time and effort.

See also an article on how to add a warning message to emails originating from outside of the organization and then remove it from replies.

Suggested reading:


Recommended articles

CodeTwo dominated top software review sites in 2024

CodeTwo dominated top software review sites in 2024

Our software earned multiple badges and tons of positive feedback. Find out how we did.
CodeTwo wins multiple 2025 Best Software Awards from G2

CodeTwo wins multiple 2025 Best Software Awards from G2

Our software has been recognized as one of the best in the world. Check out our winning categories.
CodeTwo: the email signature leader in G2’s Winter 2025 reports

CodeTwo: the email signature leader in G2’s Winter 2025 reports

Our software got some exquisite reviews on G2.com. See what our clients have to say.

Comments

  1. We want to remove a number with a hash that exist in front of the subject ex. “#123456 My subject” to become “My subject”.
    The number after the hash is dynamic.
    How can we set code two exchange rules to remove all text until the first space and keep the rest in subject line?

  2. We use HTML disclaimers:

    CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

    Doesn’t seem to work to remove those at reply.

    • Hi Julien,
      I’ve just configured the disclaimer and a rule using the same keyphrase you have used and it runs without issues. Please double check your conditions to make sure the rule applies to those replies.
      Another important thing is not to use any quotation marks while specifying the phrase that should be deleted. It’s best to copy and paste the exact same phrase for the disclaimer and the keyword. If the issue persists, try removing the colon (:) from both the disclaimer and the keyword that should be deleted.

    • avatar
      Kamil Glaser says:

      Hi Jay,
      You can simply add another condition (as Milena describes in point 3c) to apply the rule only to outgoing messages. When you set up a new rule, you need to take the other rules into account and how they work together to reach exactly what you need.

  3. Unfortunately it is not possible to remove a line that includes a piece of HTML (‘click >a href=”#foo”>here to mark this message as spam’, ‘sent with Outlook for IOS‘). This means that replying to an external message will expose our internal ‘mark as spam’ link to the customer.

    • Hi Sander,
      You are right – unfortunatelly in the current version, it is not possible to entirely delete links and other HTML pieces. However, if you choose to delete the whole hyperlink text (for example, “Outlook for iOS”), the link will not appear in the email content. To see it, the recipient would have to inspect the source HTML of an email, which is rather unlikely for email users.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

CodeTwo sp. z o.o. sp. k. is a controller of your personal data.
See our Privacy Policy to learn more.