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.

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 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 ({rt}) button on the Editor's ribbon (Fig. 1.).

787-1
Fig. 1. Use the {rt} button to wrap RT tags around the selected element.

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

787-2
Fig. 2. 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. 3.).

787-3
Fig. 3. 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. 4.).

787-4
Fig. 4. 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. 5.).

787-5
Fig. 5. 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. 6.) 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 Save button in the source code view, then save the changes again in the Editor window.

787-6
Fig. 6. 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.

Warning

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.