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
- How to use RT tags to automatically remove a table row that contains an empty AD attribute placeholder
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
- Open your CodeTwo software and edit the signature template with AD attribute placeholders which are replaced with empty spaces for some email senders.
- 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}.
- Use the mouse to highlight (select) both elements and click the Remove Text tag button on the editor's ribbon (Fig. 1.).
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.
Fig. 2. The Remove empty placeholder button in the CodeTwo Email Signatures 365 signature template editor.
- RT tags will be automatically inserted in front of and behind the selected phrase (Fig. 3.).
Fig. 3. The selected element has been surrounded by RT tags.
- 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.).
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.
- 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.).
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.).
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:
- Open your signature in the editor and switch to the HTML source code view by clicking the </> Source button on the ribbon.
- Find the appropriate <tr> element for the table row with Fax information.
- 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.
- Save your changes via the Apply & Close button in the source code view, then save the changes again in the editor's window.
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).
Related products: | CodeTwo Email Signatures for Office 365 1.x, CodeTwo Exchange Rules 2.x, 3.x, CodeTwo Exchange Rules 2007 1.x, 2.x, 3.x, 4.x, CodeTwo Exchange Rules 2010 1.x, 2.x, 3.x, CodeTwo Exchange Rules 2013 1.x, 2.x, CodeTwo Exchange Rules 2016 1.x, CodeTwo Exchange Rules 2019 1.x, CodeTwo Exchange Rules Pro 1.x, 2.x |
Categories: | How-To |
Last modified: | July 11, 2023 |
Created: | January 28, 2019 |
ID: | 787 |