CodeTwo Base.title

Creating hyperlinks of any color using Active Directory variables with Rotating Text

Problem:

Change the color of hyperlinks created with values from Active Directory.

Solution:

See this section if you are using the following or newer versions CodeTwo Exchange Rules family software:

  • Pro 2.x
  • 2016 1.x
  • 2013 2.x
  • 2010 3.x
  • 2007 4.x

See this section if you are using the following or older versions CodeTwo Exchange Rules family software:

  • Pro 1.x
  • 2013 1.x
  • 2010 2.x
  • 2007 3.x

Solution for older versions of CodeTwo Exchange Rules software (Pro 1.x, 2013 1.x, 2010 2.x, 2007 3.x):

With the newer versions of CodeTwo Exchange Rules 2007/2010/PRO linked Active Directory fields such as email as link in template editor are blue by default. Users can change links font type, style and size, but color remains blue, as shown in the example in Fig. 1.

610
Fig. 1. Email as link dynamic fields remain blue in a default state despite applying color.

There is a workaround that allows changing color of the hyperlinks by "building" them from parts imported by Rotating text fields from external sources. If you are not familiar with the concept of creating hyperlinks using Rotating text fields please read this article before you continue.

For the purpose of this article let's say we want to insert into our footer an email address that is red instead of blue and is clickable. Normally, the signature would look like in the image Fig. 2.

621
Fig. 2. Simple signature with the E-mail Dynamic field.

However Dynamic field - E-mail does not create a clickable link and E-mail as link field is always blue. Also, Exchange Rules editor does not recognize an HTML "mailto" link. We need to use Rotating text fields which are located in the Dynamic field menu (Fig. 3).

622
Fig. 3. Location of the Rotating Text field in the upper menu.

We need to "build" an HTML "mailto" link from parts of the code located in external source - files on the hard drive and from E-mail Dynamic field (as Dynamic fields work only when inserted directly in the editor).

An HTML "mailto" link could look like this one:

<A style="COLOR: #ff0000;" href="mailto:{E-mail}">{E-mail}</A>

 

Everything in the code except for E-mail Dynamic fields must be imported from external files. Let's create a proper structure of Dynamic Fields in the editor as in the Fig. 4.

623
Fig. 4. Structure of the Dynamic Fields in the footer prepared for "mailto" link building.

Next we need to prepare appropriate folders and files structure as in the Fig. 5 as well.

624
Fig. 5. Folders and code source files structure on the hard drive.

Click on the first Rotating text field and using menu on the right point to a desired folder on the hard drive (Fig. 6).

625
Fig. 6. Linking {Rotating Text} fields with the code source files on the hard drive.

Save and close your editor and save your settings in the Administration module. Let's test our rule by sending a test email. Before that, make sure you have applied appropriate Conditions. The result should look more or less like this - link is red and clickable, works just like typical an HTML "mailto" link - Fig. 7.

626
Fig. 7. Signature with working red and clickable email address.

If you do not want the HTML "mailto" link to be underlined like the hyperlinks usually are, your hyperlink code must include "TEXT-DECORATION: none" attribute. So the full link code should look like this one:

<A style="COLOR: #ff0000; TEXT-DECORATION: none;" href="mailto:{E-mail}">{E-mail}</A>

Please be aware that the user Network Service must have appropriate permissions to the folder that stores your rotating text or rotating images folders and files. To do it, right click on the desired folder, choose Properties, Security tab and add Network Service user (Fig. 8) to the list with permission to Read & Execute (Fig. 9).


Fig. 8. Adding the Network Service user to the list of permissions.


Fig. 9. Adding appropriate permissions for the Network Service user.

Solution for newer versions of CodeTwo Exchange Rules software (Pro 2.x, 2016 1.x, 2013 2.x, 2010 3.x, 2007 4.x):

Open the editor, and then switch to the Source view.

250-2
Fig. 10. Switching to source code view.

Now, add the following code to the <body> section of signature:

<a href="mailto:{E-mail}" style="color: #f00;">Your text here</a>

where:

  • mailto:{E-mail} stands for target of your hyperlink. You can also change it to any Web page address, e.g. http://codetwo.com
  • color: #f00; stands for your link color. You may also add more CSS attributes.
  • Your text here stands for visible text. It can also contain placeholders e.g. {E-mail}

After that you can switch again to the Designer view. Your link should now be red, as in the image below.

250-3
Fig. 11. Red hyperlink in Designer view.

You can also consider hyperlinking an image instead of standard text. To do so, please follow the steps below:

  1. Use Picture button on the Editor's ribbon and add your image.
  2. Open Source view.
  3. Click that image and on the Editor's ribbon choose Insert hyperlink.
    InsertingHyperlink
    Fig. 12. Adding hyperlink.
  4. Provide the desired URL (e.g. http://example.com/) without any placeholders at this moment.
  5. Open the Source view and find the A tag responsible for hyperlinking your image.
  6. To the href attribute add requested placeholders. Let us assume that the main address is http://example.com/profile/ and we have a user named Howard Wilford. If you set the href attribute to the following:
    <A href="http://example.com/profile/{First name}.{Last name}">
    it will change during processing of a message into:
    <A href="http://example.com/profile/Howard.Wilford">
    Add hyperlinked AD placeholder
    Fig. 13. Adding placeholders.
Our Clients:
Unicef
Facebook
Shell
T-Systems
Loreal
Casio
UPS Israel
Oford University
Mitsubishi Motors
Toshiba TEC UK Imaging Systems Ltd
Illinois Institute of Technology
MAN Diesel
McDonalds India
Skoda Auto
Bank of Israel
Fujifilm
China Mobile
Santander
Samsung SDI
Skanska
Generali
Telmex
Toyota Tsusho
BECHTEL
Ricoh
BAE SYSTEMS
Federação Portuguesa de Futebol
Credit Agricole
HYUNDAI
Rothschild
Toyota Boshoku
Oriflame Romania
ING
Ikea
Nordea

Partners, certificates & awards