Use conditional placeholders

There are two types of placeholders available in the signature template editor: regular and conditional.

A regular placeholder is replaced with a value based on the message sender (pulled from Azure AD) or message properties, current date, etc. For example, the {First name} placeholder will change into sender’s first name. If the value is not available (e.g. user’s AD attribute is missing), the placeholder will be empty (note: you can use RT tags to remove empty lines). Learn more and see all available placeholders

A conditional placeholder can be replaced with one of many values, depending on a set of user-defined rules (conditions). In other words, you assign multiple values to a conditional placeholder and specify when each of these values should replace this placeholder. The value that replaces a conditional placeholder can be anything from a single plain-text phrase or image to a piece of HTML code. You can use regular placeholders as conditional placeholders’ values as well.

Conditional placeholders can be used to:

  • insert another phone number to an email signature if a sender has no phone number specified in Active Directory (learn more),
  • insert marketing banners in different languages, depending on e.g. senders’ Country attribute in AD,
  • insert different office addresses, depending on e.g. the City attribute,
  • insert custom information in an email signature for selected users only,
  • insert generic contact information when corresponding attributes are missing in AD (instead of removing empty placeholders by using RT tags),
  • and many more.

Each conditional placeholder can have multiple rules defined, and each rule consists of a condition and placeholder value (Fig. 1.). Conditions are built using email sender's Azure AD attributes. Only one value is inserted into an email signature, depending on which condition is met first. If none of the conditions defined in the placeholder rules are met, the default placeholder value is used.

This conditional placeholder inserts a generic phone number if an email sender has no phone.
Fig. 1. This conditional placeholder inserts a generic phone number if an email sender has no phone.

Follow the links below to learn how to:

Create a new conditional placeholder

Conditional placeholders are created and managed in the Conditional placeholders manager. To open the manager, click the Conditional placeholder button on the ribbon and select Manage (Fig. 2.).

Opening the Conditional placeholders manager.
Fig. 2. Opening the Conditional placeholders manager.

Click Editor - conditional placeholders - add rule icon above the Placeholders list to create a new conditional placeholder (Fig. 3.). Make sure to provide a unique name for the placeholder. The program will notify you if you enter a name that is already used by another placeholder, either regular or conditional.

Creating a new conditional placeholder.
Fig. 3. Creating a new conditional placeholder.

To change the placeholder’s name or delete it, use the Editor - conditional placeholders - rename icon or Editor - conditional placeholders - delete icon button, respectively, or right-click the placeholder on the list and select what to do with it.

Create a placeholder rule

Placeholder rules contain all conditional values of the placeholder. To create a new rule, click Editor - conditional placeholders - add rule icon above the Placeholder rules list (Fig. 4.). Use the Editor - conditional placeholders - delete icon button to remove unnecessary placeholder rules. A placeholder rule comprises a condition that has to be met and a placeholder value that will be used if the condition is met. 

Creating a new placeholder rule.
Fig. 4. Creating a new placeholder rule.

Important

The order in which the rules appear on the Placeholder rules list is important. The program checks each rule from the top to the bottom of the list and replaces the placeholder with the value of the first condition that is met. Use the Editor - conditional placeholders - move up icon and Editor - conditional placeholders - move down icon buttons to change the position of the rule on the list.

You can use this feature to your advantage. Check this example of use for more details.

To get a conditional placeholder to work, you need to take the following steps:

Define conditions for a placeholder rule

Click the  button in the Condition column to open the Placeholder rule conditions builder (Fig. 5.).

Opening the Placeholder rule conditions builder.
Fig. 5. Opening the Placeholder rule conditions builder.

Conditions are based on sender’s properties, such as email address, group membership or AD attributes, such as City, Company, Phone number, etc.

You can create complex conditions by inserting additional AND or OR clauses or by grouping clauses with the GROUP button (select multiple clauses while holding the Ctrl or Shift keys).

Important

You can only define conditions (not exceptions) for the placeholder rules. If you need to exclude specific users from getting certain elements in their signatures (like banners), you can do so by creating separate signature rules (signature templates) and determining which users should have access to them when configuring these rules.

For some hints on how to use the Placeholder rule conditions builder, see the examples below.

Example 1

This simple condition will trigger the placeholder rule if an email sender belongs to the Sales and Marketing group (Fig. 6.).

An example of a placeholder rule condition – the rule applies to all senders that belong to the Sales and Marketing group.
Fig. 6. An example of a placeholder rule condition – the rule applies to all senders that belong to the Sales and Marketing group.

Example 2

For the rule to be applied only when senders hold higher or top managerial positions (e.g. manager or director), you can build the following conditions (Fig. 7.):

An example of a placeholder rule condition – the rule applies to all senders whose job title includes the word manager or director.
Fig. 7. An example of a placeholder rule condition – the rule applies to all senders whose job title includes the word manager or director.

Example 3

The combination of conditions shown in Fig. 8. will apply the placeholder rule to the senders that occupy a senior job position and are members of the Sales and Marketing group as well as to the user whose email address is sales@example.com (but who doesn’t necessarily hold a “senior” position or belong to the sales group).

An example of a placeholder rule condition – the rule applies to all senders whose job title includes the word senior and who belong to the Sales and Marketing group as well as those whose email address is sales@example.com.
Fig. 8. An example of a placeholder rule condition – the rule applies to all senders whose job title includes the word senior and who belong to the Sales and Marketing group as well as those whose email address is sales@example.com.

Define conditional placeholder values

A placeholder value is what the program inserts into an email signature in place of a conditional placeholder. The Conditional placeholder manager allows you to define:

  • an indefinite number of conditional values, i.e. values that will be used only if certain rule conditions are met;
  • a default placeholder value, which will replace the placeholder in an email signature if none of the conditions set out in the placeholder rules are met.

To select the value, click the  button in the Placeholder value column (or under Default placeholder value). This will open a drop-down menu (Fig. 9.) with all the available objects you can use.

A list of available objects that can be used as conditional placeholder values.
Fig. 9. A list of available objects that can be used as conditional placeholder values.

The following objects can be used as placeholder value:

Tip

You can define multiple objects (e.g. two regular placeholders, a placeholder and a picture, two pictures, etc.) as a single placeholder value. However, if you plan to do so, it would be a good idea to use the HTML content option, which gives you more editing options and a better view of how the placeholder value will look like when inserted to an email signature.

Regular placeholders

The Message Sender, Message properties* and Other* objects in the placeholder value drop-down menu let you select regular placeholders, such as sender’s Azure AD attributes (e.g. City, Company, Phone number, etc.), Message date, Message ID or Current date/time. You can insert multiple placeholders as well as separate them with, for example, commas and static text. You can also use the <br> tag between them (however, this will change the placeholder value field to the HTML content the next time you open the Conditional placeholder manager).

Learn more about regular placeholders available in CodeTwo Email Signatures for Office 365

* The Message properties and Other objects are available only for server-side signature rules. 

Picture

If you want the conditional placeholder to be replaced with an image, select the Picture object from the drop-down menu. This will open the same window that is used to insert images to email signature template (learn more about the Insert picture option). After you select the image, you can use the  button to change its properties (Fig. 10.).

You can change the picture properties by clicking the … (ellipsis) button.
Fig. 10. You can change the picture properties by clicking the … (ellipsis) button.

Plain text

Select Plain text if you want to use static text as a placeholder value.

Tip

This object can be also used to clear the Placeholder value cell of any objects defined earlier.

HTML content

The HTML content object opens the Edit HTML Snippet window (Fig. 11.) that looks like a simplified version of the signature template editor. This simplified editor also has most of the options used to create full-featured email signature templates.

The Edit HTML Snippet window used to edit placeholder values.
Fig. 11. The Edit HTML Snippet window used to edit placeholder values.

If you select another object in the Placeholder value cell (e.g. a placeholder or picture) and then select HTML content from the drop-down menu, this object will appear in the Edit HTML Snippet window as well (Fig. 12.).

The Edit HTML Snippet window can be used to edit all objects used as placeholder values.
Fig. 12. The Edit HTML Snippet window can be used to edit all objects used as placeholder values.

After you finish configuring a conditional placeholder, click Save in the Conditional placeholders manager to apply your changes and make the placeholder available for use in the signature template editor. The program will notify you when it finds any issues with your placeholder (e.g. missing values). However, if you left the value field blank on purpose, you can click Save changes anyway (Fig. 13.).

A validator checks if there are any problems with your conditional placeholders.
Fig. 13. A validator checks if there are any problems with your conditional placeholders.

Tip

Make sure to use RT tags together with your conditional placeholder. That way, if the placeholder has no value, the program can remove the empty space from the email signature. Learn more about the Remove empty placeholder option

Insert a conditional placeholder

After you created a conditional placeholder, you can insert it into your email signature template. To do so, first place the cursor in the signature where you want to insert the placeholder. Next, select Conditional placeholders on the ribbon and click the name of the conditional placeholder you want to use (Fig. 14.).

Inserting a conditional placeholder to a signature template.
Fig. 14. Inserting a conditional placeholder to a signature template.

Notice that once you insert a conditional placeholder into your template, it gets a numerical ID, e.g. {Marketing banner 1}. When you insert the placeholder again, it will be numbered sequentially, i.e. {Marketing banner 2}. This is important when editing placeholders, as changes made to {Marketing banner 1} will not be applied to {Marketing banner 2} and the other way around. Learn more

You can use the Signature preview functionality to see how the conditional placeholder’s value changes as you select different users and when different conditions are met.

Edit a conditional placeholder

To edit a conditional placeholder inserted into a signature template, right-click the placeholder and select Edit placeholder (Fig. 15.). Be sure to click OK to apply your changes.

Note that this allows you to change the conditions and values of this specific instance of the conditional placeholder only (e.g. {Marketing banner 1}), in the signature template that is currently being edited. When you add the conditional placeholder again to the same template (in which case it will be numbered accordingly, e.g. {Marketing banner 2}) or use the placeholder in another template, you need to apply the necessary changes to these new instances as well.

Editing a conditional placeholder by using the Edit placeholder option from the shortcut menu.
Fig. 15. Editing a conditional placeholder by using the Edit placeholder option from the shortcut menu.

It is also possible to edit conditional placeholders (change their names, conditions and values) in the Conditional placeholders manager (Fig. 16.). However, if you insert a conditional placeholder to a signature template but then make some changes to this placeholder in the Conditional placeholders manager, the inserted placeholder will not be updated with your changes. You need to remove the placeholder from the template and insert it again.

Editing a conditional placeholder in the Conditional placeholders manager.
Fig. 16. Editing a conditional placeholder in the Conditional placeholders manager.

Important

If you have used this conditional placeholder in other templates as well, you need to update (reinsert) it everywhere. Note that when the conditional placeholder is inserted again, the next consecutive number is added to its name (Fig. 17.).

Each conditional placeholder added to a signature template is a separate instance and has a different, consecutive number added to its name.
Fig. 17. Each conditional placeholder added to a signature template is a separate instance and has a different, consecutive number added to its name.

Examples of use

How to insert different information to an email signature if a certain AD attribute is missing

By default, if a placeholder cannot be filled with user information, e.g. because this information is missing from the Active Directory, an empty space will appear in an email signature instead of the placeholder (this empty space can be easily removed using the Remove empty placeholder option). However, by using conditional placeholders, it is also possible to replace that placeholder with different information, e.g. taken form a different AD attribute or with a fixed value.

Conditional placeholders prove very useful in the common scenario illustrated below. Follow these steps to create a conditional placeholder that inserts a different phone number to an email signature if the Phone attribute has no value specified in sender’s AD.

  1. Open the Conditional placeholder manager and create or edit a conditional placeholder (learn more).
  2. Click Editor - conditional placeholders - add rule icon above the Placeholder rules list to add a new rule.
  3. Click the  button in the Condition column to open the Placeholder rule conditions builder.
  4. Add the following condition:
    • Sender property > Phone
    • Operator > exists (Fig. 18.) and click OK.

Creating a condition that will apply to all users who have the Phone AD attribute defined.
Fig. 18. Creating a condition that will apply to all users who have the Phone AD attribute defined.

  1. In the Placeholder value column, click the  button and select: Message Sender > Phone & fax > Phone (Fig. 19.). That way, if a sender has the Phone attribute defined in Azure AD, this value will be inserted into an email signature. 

Selecting the Phone attribute as the value for the first placeholder rule.
Fig. 19. Selecting the Phone attribute as the value for the first placeholder rule.

  1. (Optional) If you also want the program to search for a phone number through other AD attributes (Mobile, Home phone, etc.) and insert whatever can be found into an email signature, you can add additional rules, as shown in Fig. 20.

Adding more rules to the conditional placeholder.
Fig. 20. Adding more rules to the conditional placeholder.

Important

The rules are checked from the top to the bottom of the placeholder rules list, and the conditional placeholder will be replaced with the value of the first rule whose conditions are met.

  1. In the Default placeholder value field (Fig. 21.), click the  button, select Plain text, and provide a phone number (e.g. company's generic phone number). This phone number will replace the conditional placeholder in an email signature in case none of conditions defined in placeholder rules were met (which means the sender has no phone number defined in any of the specified AD attributes).

Providing the default placeholder value that will replace the placeholder if none of the conditions are met when an email is sent.
Fig. 21. Providing the default placeholder value that will replace the placeholder if none of the conditions are met when an email is sent.

  1. Click Save and then insert the conditional placeholder to your signature template.
  2. You can use the Signature preview button on the editor's ribbon to check what the placeholder will look like when inserted to an email sent by different users.

Was this information useful?