Conditions and exceptions

Signature rules let you decide when to add email signatures, and to which senders. The signature adding algorithm is based on conditions and exceptions. Conditions are circumstances that need to be fulfilled to trigger a signature rule. Exceptions are the exact opposite - they suppress the action of adding a signature. Conditions and exceptions are defined in the Manage Signatures App, on the Senders, Keywords and Email direction tabs, with additional settings available on the Options tab. This article explains:

Defining conditions and exceptions for a signature rule

This section will show you how to configure conditions and exceptions. To start, launch the Manage Signatures App, log in to your tenant and select one of your rules (or add a new one and name it on the Overview tab). Proceed to the Senders tab. 


The Senders tab lets you specify to which users or groups your signature rule will be applied (Fig. 1.). On the top list (Add signatures to emails...) you can define conditions by choosing senders whose emails will be stamped with your signature. The bottom list (Do not add signatures to emails...) allows you to add exceptions, i.e. users or groups who will not get the signature. In the example below we configured the rule to add signatures to emails sent by our IT guys, excluding the managers.

ESIG for O365 conditions - senders 1
Fig. 1. The Senders tab with 1 condition and 1 exception configured.

The program allows you to define the conditions and exceptions in many ways, e.g. by adding all/individual users, groups, or setting filters (Fig. 2.).

Various selection options.
Fig. 2. Various selection options.

Keep in mind that the scope of users who can get signatures might also be limited during the configuration of connectors.

In our example (Fig. 1.), the software knows when to add signatures because we added an Azure Active Directory filter condition to check if the sender's Department field in Active Directory is equal to IT (Fig. 3.). In a similar way, an exception to the rule was defined: if the user's Title in AD contains the value Manager, the rule will not be triggered.

Azure AD filter options.
Fig. 3. Azure Active Directory filter options.

Thanks to all these user configuration possibilities, you can apply your signature rule to a group of users and exclude one or more users at the same time, e.g.:

  • add a signature to the whole IT department except for the manager whose signature is covered by a different rule for managers, as shown in the example above;
  • add a legal disclaimer to all company emails except for the emails of employees from a foreign site, because different laws apply there;
  • add signatures with marketing banners to the whole customer support department but not to emails sent by people from other departments, etc.


Remember to define at least one user in the conditions field (top list). If you leave this section empty, signatures will be added to all users specified in the connectors wizard (learn more). The program will notify you about that (and automatically add the All users condition to the list) when you submit your changes via the Save (ESIG for O365 rule save) button.

If you would like to create a rule, but do not want to apply it to any users, you can temporarily disable it via the switch (ESIG for O365 rule switch) button.


The Keywords tab (Fig. 4.) allows you to define specific phrases that will trigger or suppress your signature rule. This option is very useful e.g. when you want to apply an additional signature only to selected recipients or if you want to quickly remove the default signature of your company from a private message. The latter is shown in Fig. 4.: if the program finds the #nosignature phrase in the email subject or body, the signature will not be added and the phrase itself will be removed from the message.

ESIG for O365 conditions - keywords 1
Fig. 4. The Keywords tab.

When adding or editing a keyword (Fig. 5.) you can define where to search for the phrase and decide if the program should delete it from the message.

Keyword configuration options.
Fig. 5. Keyword configuration options.


You can insert your keyword anywhere inside the message title or body. An asterisk (*) may be used as a wildcard character. Add it before and/or after the phrase to make sure that your keyword is always found (see Fig. 5.).

Email direction

The Email direction tab (Fig. 6.) lets you decide if a signature rule should be applied to all sent emails or to internal/external correspondence only.

ESIG for O365 conditions - email direction
Fig. 6. The Email direction tab.

What happens if my email contains both internal and external recipients?

If an email contains both internal and external recipients, and you have different rules configured for each message direction, then the outcome will depend on how Exchange Online processes this message. Usually, Exchange Online splits such emails into two messages - one with internal and one with external recipients - and delivers each type separately to the CodeTwo Email Azure Service. In this scenario, different rules are applied to external and internal recipients, as expected. In rare cases, e.g. when you use a non-standard email client, Exchange Online might not split your message. In such situations, our program will apply the rule for external recipients to process this email. 


On the Options tab (Fig. 7.) you can:

  • define how the program should process subsequent rules if you have more than one,
  • use the Scheduler to specify when your rule will be active.

ESIG for O365 conditions - options
Fig. 7. The Options tab.

​The Scheduler is configured separately for each signature rule. It allows you to manage the activity of a rule by selecting time ranges and recurrence patterns. You can create daily, weekly, monthly or custom patterns (Fig. 8.). If you turn the Scheduler on for your rule, a small icon appears next to the rule's name (see Fig. 7.). This icon shows if the rule is currently active (ESIG for O365 scheduler button ON) or not (ESIG for O365 scheduler button PAUSE).


If the Scheduler is off or is not yet configured for a signature rule, this rule will be active continuously (without any time limits).

The Scheduler.
Fig. 8. Configuration of the Scheduler.

Understanding conditions and exceptions

As described above, the Senders, Keywords and Email direction tabs let you set conditions/exceptions that need to be fulfilled by a message to trigger a rule and add/exclude an email signature. Apart from conditions/exceptions, you can specify when a signature rule should be active by using the Scheduler available on the Options tab.

To use the program efficiently, you need to understand how conditions and exceptions are related.


Conditions can be defined in the upper lists of the Senders and Keywords tabs and on the Email direction tab. By default, all these conditions are connected via the and logical operator (logical conjunction). This means that:


All defined conditions have to be fulfilled to trigger a rule and add a corresponding signature.

As an example, let us analyze the following scenario: a company has a new product "XYZ" and would like to add a dedicated signature to selected emails sent by the marketing team outside the organization. Let us assume that a signature template for our new product is already prepared and we only need to define conditions.

First, we add the Online Marketing group as the only condition in the Senders tab, with no exceptions (Fig. 9.). This means that our signature will be added only to emails sent by employees from Online Marketing.

ESIG for O365 understanding conditions - senders
Fig. 9. The Senders tab with one condition.

Next, we define a keyword condition (upper list in the Keywords tab), as shown in Fig. 10. Now the dedicated signature will be added only to emails sent by Online Marketing which contain the XYZ phrase in their subjects. The message subjects will remain unchanged (the keyword phrase will not be removed).

ESIG for O365 understanding conditions - keywords
Fig. 10. Defining a keyword condition.

Finally, we set the email direction to external only (Fig. 11.).

ESIG for O365 understanding conditions - direction
Fig. 11. Configuration of the email direction condition.

With this configuration, our signature will be added only to emails which simultaneously fulfill all 3 conditions:

  • are sent by Online Marketing
  • and contain the XYZ phrase in the message subject
  • and are sent to users outside the organization.


Exceptions (the bottom lists on the Senders and Keywords tabs) are connected via the or logical operator (logical disjunction). In other words:


If you define several exceptions, a signature rule is suppressed for each exception individually.

The following example will help you understand how the exceptions are processed by the program. Let us modify the signature rule described in the previous example. On the Senders tab, we add an exception (the bottom list) by creating an Azure AD filter, as shown in Fig. 12. This will exclude the users whose names contain letter A or a (our search algorithm is case-insensitive) from having their emails stamped with the associated signature.

ESIG for O365 understanding exceptions - senders
Fig. 12. Adding an exception to email senders.

We can add an additional exception on the Keywords tab, as shown in Fig. 13. Now every email which contains the removesignature phrase in its body or subject will not receive the signature, and the phrase itself will be removed from the message.

ESIG for O365 understanding exceptions - keywords
Fig. 13. Defining a keyword exception.

With these 2 exceptions and 3 conditions combined, our rule will:

  • add signatures only to emails sent by Online Marketing which contain the XYZ phrase in the message subject and are external,
  • not add signatures in 2 cases: if emails are sent by users whose names contain letter A or if the removesignature phrase is found in the message subject or body.

Adding signatures to messages sent by delegates

Sometimes a user or a group of users have permission to send messages as other users or on their behalf. These users are referred to as delegates (see Microsoft Technet, e.g. this article, for more information on delegate permissions).

If User A, who has the Send As right to the User B's mailbox, sends a message and enters the User B's email address into the From field, this message will be considered as sent by User B. Therefore, the rules covering User B will be executed.

However, User A may also have the On behalf of delegate permissions to the mailbox of User B. In such a case, if User A enters the email address of User B into the From field when sending a message, the message will be considered as coming from User A, and the rules covering User A will be executed.


Delegate permissions may affect the visibility of signatures in the Sent Items folder. For more information, see this article.

See next

Signature editor - read about the main features of the built-in signature editor.

Template library - learn how to use the signature templates available in the program and how to create custom templates.

Was this information useful?