Knowledge Base

How to automatically remove signature elements (placeholders) that cannot be replaced with AD data

Problem:

Your email signature template contains an AD attribute placeholder that is dynamically filled with a matching attribute value from Active Directory when an email is sent. If the sender does not have this particular attribute in AD, then an empty space is left in the signature where the placeholder should be. This article shows how to remove AD attribute placeholders (and the space they occupy) on the fly when they cannot be replaced with data from Active Directory.

Solution:

CodeTwo programs feature a built-in capability to process Remove Text (RT) control tags. RT tags are particularly useful for signatures/disclaimers that include Active Directory placeholders: by surrounding a placeholder with RT tags, the CodeTwo software will automatically remove it from a signature if that placeholder cannot be filled with the corresponding data from Active Directory.

Remove Text tags can remove not only the empty attributes themselves, but also the accompanying (signaling) phrases that introduce these attributes (such as Phone:) or even the whole HTML elements that contain these attributes. For example, if your signature contains a table row with an AD attribute placeholder, the RT tags functionality can remove the entire table row if this attribute is empty. Use the links below to learn more and see examples.

Conditional placeholders

CodeTwo software also features conditional placeholders that can be used as an alternative for RT tags. Instead of removing empty placeholders, conditional placeholders can be used to insert custom data into email signatures in case some AD attributes are missing, e.g. company’s generic phone number instead of sender’s personal phone number, an avatar instead of a user photo, a department name instead of a job name, and so on. Learn more about conditional placeholders used in:

How to use RT tags to automatically remove empty AD attribute placeholders and accompanying phrases

  1. Open your CodeTwo software and edit the signature template with AD attribute placeholders which are replaced with empty spaces for some email senders.
  2. In the template editor, find the placeholder and the related signaling phrase (if there is one) in your signature. Let's assume that the placeholder and the preceding phrase look like this: Phone: {Phone}.
  3. Use the mouse to highlight (select) both elements and click the Remove Text tag button on the editor's ribbon (Fig. 1.).

The Remove Text tag button in the editor of the Exchange Rules software family.
Fig. 1. The Remove Text tag button in the editor of the Exchange Rules software family.

Info

The signature template editor in CodeTwo Email Signatures 365 differs slightly but retains the same functionality (Remove empty placeholder), as shown in Fig. 2.

The Remove empty placeholder button in the CodeTwo Email Signatures 365 signature template editor.
Fig. 2. The Remove empty placeholder button in the CodeTwo Email Signatures 365 signature template editor.

  1. RT tags will be automatically inserted in front of and behind the selected phrase (Fig. 3.).

787-2 v3
Fig. 3. The selected element has been surrounded by RT tags.

  1. Now, if the placeholder wrapped with RT tags does not have a corresponding value in AD (for a given message sender), it will be automatically removed by CodeTwo software. However, before you save the changes in the software, make sure that the phrase to be removed does not occupy a whole line of text. If it does (as in the example above), an empty line might remain in the signature (Fig. 4.).

Depending on your signature layout, an extra text line might remain after an AD attribute placeholder is removed. This can be easily fixed.
Fig. 4. Depending on your signature layout, an extra text line might remain after an AD attribute placeholder is removed. This can be easily fixed.

  1. To avoid this empty line, you need to modify the Remove Text tags by moving the closing RT tag ({/RT}) to the beginning of the next line (Fig. 5.).

An example of correctly configured RT tags and the resulting signature (the text line with the Phone attribute has been correctly removed).
Fig. 5. An example of correctly configured RT tags and the resulting signature (the text line with the Phone attribute has been correctly removed).

Example #1 (bad)
This is an example of a signature in which the line containing the phone number is removed if this number is missing for a user in Active Directory:

{First name} {Last name}
{RT}Phone: {Phone}{/RT}
E-mail: {E-mail}

If RT tags are used as shown above, the whole content in between {RT} and {/RT} will be removed if the {Phone} attribute in AD has no value. As a result, an empty line will appear instead. If you would like to have this empty line removed when RT tags are used, you need to modify the signature by putting the RT closing tag ({/RT}) at the beginning of the next line, as shown in the second example:

Example #2 (good)

{First name} {Last name}
{RT}Phone: {Phone}
{/RT}E-mail: {E-mail}

How to use RT tags to automatically remove a table row that contains an empty AD attribute placeholder

Remove Text tags can be used to remove certain HTML elements (syntax) if these elements include empty AD attribute placeholders. A typical situation when you might want to automatically remove an element is when you use a signature based on an HTML table which contains various AD attribute placeholders (Fig. 6.).

A sample signature based on a simple HTML table.
Fig. 6. A sample signature based on a simple HTML table.

Let’s assume that an email signature contains a table with two AD attribute placeholders, {Phone} and {Fax}, each in a separate row. When such a signature is added to emails, the {Phone} attribute placeholder is usually filled in for every sender, unlike the {Fax} field. To keep your signature layout clean, you can remove the entire table row with the fax number if this number is not populated with AD data (the sender's Active Directory account has no Fax attribute). To do so, please follow the steps below:

  1. Open your signature in the editor and switch to the HTML source code view by clicking the </> Source button on the ribbon.
  2. Find the appropriate <tr> element for the table row with Fax information.
  3. Select the entire <tr> element (make sure to select both the opening <tr> and closing </tr> tags, as highlighted in yellow in Fig. 7.) and click the {rt} Remove Text tag button. This will wrap the whole <tr> element with the RT tags.
  4. Save your changes via the Apply & Close button in the source code view, then save the changes again in the editor's window.

Using RT tags to remove parts of the HTML source code.
Fig. 7. Using RT tags to remove parts of the HTML source code.

From now on, if the value of your placeholder is missing, the entire row is removed without disrupting your signature layout. If you use the Remove Text tags to remove HTML elements, use the Preview button in the editor to review your changes before you apply them.

Using RT tags in CodeTwo Email Signatures 365

To access the HTML source code view in the CodeTwo Email Signatures 365 signature template editor, click the HTML source button (Fig. 8., item 1). Here, you can insert an {RT} tag by clicking the Remove empty placeholder button (Fig. 8., item 2).

Signature template editor – HTML source code view.
Fig. 8. Signature template editor – HTML source code view.

Troubleshooting

If the table row is not removed despite using Remove Text tags, you can also try adding the tags inside HTML comments, as shown in Fig. 9.

Using RT tags inside HTML comments.
Fig. 9. Using RT tags inside HTML comments.

Was this information useful?