How to add dynamically changing image links to emails

Problem

You would like to insert image links (images that are linked to a web resource) into email signatures, and these images should dynamically change every time a new message is sent so that each message gets a different picture. For example, you have several marketing banners, and you would like CodeTwo software to add a different banner (linking to a corresponding marketing campaign) to every email.

Solution

Signature-adding CodeTwo programs allow you to enhance email signatures by adding dynamic content. When an email is sent, this type of content is randomly or sequentially pulled from a user-defined repository and inserted (embedded) to this email. Dynamic content can be added to signatures by using two types of dynamic content placeholders: {Rotating text} and {Rotating image}. Click the links below for guidelines.

Current versions of CodeTwo software

If you want to include dynamically changing image links in email signatures, you need to prepare separate folders for pictures and for links. The files in these folders should follow a specific naming convention to make sure they are sorted in sequential order.

  1. Create two folders on your disk: one for images and one for links. Name these folders appropriately for easy identification, for example C2IMG and C2TXT (Fig. 1.). The location of these folders depends on the CodeTwo software:
  • Exchange Rules (Pro): if the software is installed on multiple Exchange servers, you need to create these folders in the same location (path) on each Exchange server;
  • Email Signatures for Email Clients: you need to create these folders on a network drive that can be accessed by Client Apps on every machine where Client Apps are installed (allow all users to access these folders). If it's impossible to use a network drive, create these folders on each client's PC. Remember to use the same location path on all machines.

201-1 new
Fig. 1. A sample link folder (left) and image folder (right).

  1. Open the image folder and add pictures that you want to use as a hyperlinked content. Use any naming pattern that allows these image files to be easily sorted (e.g. IMG01.jpg, IMG02.jpg, IMG03.jpg). Make sure that all files have the same extension (format).
  2. Open the folder with links and add TXT, HTM or HTML files. Each of these files needs to include a link to respective website / landing page (e.g. https://codetwo.com; do not add any other content in the file). Use a similar pattern as for the images (e.g. FILE01.txt, FILE02.txt, FILE03.txt) so that the files are sorted in the same order. We recommend using the same extension for all files to make sure that the program sorts them correctly.
  3. Open your CodeTwo software and edit the signature to which you want to add a dynamically changing hyperlinked image.
  4. In the Editor, select a place where you want to insert the image, click the AD attributes button on the Editor's ribbon, and choose Dynamic content > Rotating text (Fig. 2.).

201-1
Fig. 2. Adding a dynamic content attribute in the Editor.

  1. Specify the path to the folder with links in the FolderPath field and set WorkingMode to modeSequential (Fig. 3.) or modeRandom.
    • in the Sequential mode, the links in the text files are added one by one to subsequent emails sent in your organization: FILE01.txt (the first link) is added to the first email, FILE02.txt (the second link) is added to the second email, and so forth. This is the recommended setting because it ensures that the right links are always added to the right image files (the first link and the first image file is added to the first email, and so on);
    • in the Random mode, the links are randomly pulled from your links folder (the folder with the text files) and added to emails.

201-3
Fig. 3. How to configure the {Rotating text} placeholder.

  1. Add the {Rotating image} placeholder directly next to the {Rotating text} placeholder (you can do it from the Dynamic content menu, see Fig. 2.). Fill the FolderPath field with the full path to the image folder and set the working mode to modeSequential (see Fig. 3.) so that images are correctly assigned to links.
  2. Switch to the source code view by clicking the </> Source button on the Editor's ribbon (Fig. 4.).

201-4
Fig. 4. How to open the source code view of a signature.

  1. Find the place in the code where both placeholders are located (see Fig. 5.).

201-5
Fig. 5. The part of the code that needs to be modified.

  1. Change the {Rotating text 1}{Rotating image 1} entry into:
    <a href="{Rotating text 1}">{Rotating image 1}</a>
    
    so that it becomes a hyperlinked placeholder. Basic HTML knowledge might be useful.
  2. Click Save and close the source code view.
  3. Save the changes in the Editor.
  4. You can preview the signature by clicking the Preview button on the Editor's toolbar. Use the Refresh button to see how the image and related hyperlink change. The same will happen to your emails - the program will pick one hyperlinked image for each email. The files will be picked in the sequential order (email #1 gets image #1 with link #1, email #2 gets image #2 with link #2, etc.).

201-6
Fig. 6. Previewing a signature with a dynamic image in the Editor.

Older versions of CodeTwo software

This section relates only to older (obsolete) versions of CodeTwo software. If you use a current version, see this section.

If you use CodeTwo Exchange Rules Pro 1.x, older versions of CodeTwo Exchange Rules (2007 3.x, 2010 2.x, 2013 1.x), or CodeTwo Email Signatures for Email Clients, these programs let you create signatures/disclaimers with hyperlinked images that change with each email. The signature editor of these applications offers two dynamic fields - Rotating Image and Rotating Text - to achieve this purpose.

In this scenario, you would like to add a signature with an image that links to a specific landing page to email #1. In the source code, this hyperlinked image would look as follows:

<A href="http://www.link.com/site1"><IMG border=0 src="D:\images\001.PNG"></A>

In subsequent emails, this hyperlinked image should be switched with another image and link, for example:

<A href="http://www.link.com/site2"><IMG border=0 src="D:\images\002.PNG"></A>

Warning

Such an effect cannot be achieved by editing the signature's HTML code and replacing the image path with the Rotating Image variable and replacing the link with the Rotating Text variable. The Source View of the editor does not accept placeholders to be used as parameters for HTML tags.

To get dynamically changing images with hyperlinks, you need to use the Rotating Text placeholder as a non-dynamic field that becomes part of the HTML code. Follow the steps below to do so.

  1. Prepare the folder with images

    Prepare a folder with the images that will be randomly picked and inserted into email signatures. In this example, a folder located in D:\images is used. This folder contains file 001.PNG and 002.PNG. Remember to assign correct access rights to these images.

  2. Prepare the folder with links

    Prepare a folder with TXT files. Each of these files needs to contain a specific link in its content (see Fig. 7.). For simplicity, the names of the link files should correspond to the names of the image files with which they will be inserted.

    535
    Fig. 7. How to prepare a .txt link file.

  3. Prepare folders that will contain parts of the HTML code

    The idea here is to use the Rotating Text placeholder in a different role. Each {Rotating Text} placeholder will be used to compose a single part of the whole HTML code that you want to insert into your signature template. To achieve this, each of these placeholders needs to refer to a single .htm file that contains a part of the HTML code.

    Important

    • The files need to be saved with the .htm extension (not .txt).
    • You need to create a separate folder for each of the files that you create in this step.

    Example

    Info

    In the example below, the red part always marks the section of the code that will dynamically change, while green is the static part of HTML code.

    A simple piece of HTML code:

    <A href="http://www.link.com/site1">Link</A>

    needs to be created by putting together several placeholders in the Designer view of the editor:

    {Rotating Text}{Rotating Text}{Rotating Text}Link{Rotating Text}

    where:
    {Rotating Text} #1 refers to an HTM file containing <A href="
    {Rotating Text} #2 refers to TXT files containing:

    1. http://www.link.com/site1
    and
    2. http://www.link.com/site2

    {Rotating Text} #3 refers to an HTM file containing ">
    {Rotating Text} #4 refers to an HTM file containing </A>

    Therefore, the whole code required for the hyperlinked image:

    <A href="http://www.link.com/site1"><IMG border=0 src="D:\images\001.PNG"></A>
    

    needs to be created in the Designer in the following way:

    {Rotating Text}{Rotating Text}{Rotating Text}{Rotating Image}{Rotating Text}

    where:
    {Rotating Text} #1 refers to an HTM file containing <A href="
    {Rotating Text} #2 refers to TXT files containing:

    1. http://www.link.com/site1
    and
    2. http://www.link.com/site2

    {Rotating Text} #3 refers to an HTM file containing ">
    {Rotating Image} #1 refers to image files and automatically applies <IMG border=0 src="">
    {Rotating Text} #4 refers to an HTM file containing </A>

    201-1
    Fig. 8. Graphical representation of the relationship between the Rotating Text and Rotating Image placeholders and folders and files.

    In the case of CodeTwo Email Signatures for Email Clients, you have to copy all files to all client computers. What is more, the paths to the files must stay the same.

  4. Configure the placeholders in the editor's Designer

    Once you add the Rotating Text/Image placeholders to the Designer, you need to configure them. To do that, select the first placeholder and use the Properties pane on the right side of the editor (or right-click the placeholder and choose Properties). In the Folder path field, provide the path to the folder where the file or files are located. Modify the Mask to make sure it finds the file you want to use for this placeholder (*.HTM for folders with parts of the HTML code; *.txt for folders with link files; *.jpg or *.png etc. for folders containing image files).

    Change the Working mode to modeSequential for all these dynamic (rotating) placeholders so that the program can assign the correct picture to the correct link. (Choosing modeRandom would make the program insert links and images randomly).

    537
    Fig. 9. Bind the placeholders to the folders they will reference.

    After you configure all the dynamic placeholders, the dynamic signature template is ready.

    Try avoiding using *.* as the mask for files inside folders. Sometimes there is a hidden thumbnail file inside a folder that will also be used by the placeholder if you set it to look for all files.

    If there is a problem matching the image (naming the image files and link files identically may not be sufficient to do that), you need to switch the Rotating Image Working Mode to Random, and send emails until they start to match one another. Then, you can switch back to Sequential.

See also: