How to create nested conditional Outlook email templates

In Shared Email Templates for Microsoft Outlook

The Shared Email Templates add-in has a wealth of wonderful features that are helpful on their own, but can be even more impressive when combined. This tip shows how to create conditional nested email templates by harnessing the power of template shortcuts, interactive fillable fields and If-sections.

Consider the scenario where you have several templates detailing your partner programs, product subscriptions, or other categories. You aim to craft a welcome email that dynamically incorporates specific details relevant to a given recipient. Here's how you can do it:

1. Create template shortcuts

Start by making shortcuts for each smaller template intended for nesting. To do this, select a template, click on the ## symbols in the upper-left corner of the preview pane, and type the name of the shortcut.

The image below shows two templates for the Bronze and Silver levels of the partnership program, each with the assigned shortcut.
Create email template shortcuts.

For more details, please see How to create template shortcuts.

2. Build the container template

Within your welcome email template, insert the shortcut names precisely where you want nested templates, forming a "container template" for the smaller ones.
Nest smaller email templates inside the larger one.

To insert just one smaller template at a time, you need to set a condition that will decide which nested template to include in each particular email. This condition can be based on one of the email fields such as To, Cc, Bcc, Subject line, or message body. In our case, a more flexible approach would be to base the conditions on the values of a dropdown menu. This will let you explicitly indicate which nested template to include.

To create a drop-down menu, follow these steps:

  1. Place the cursor at the end of your template and click the Insert macro button. From the list of macros, select What to Enter.
  2. In the What to enter dialog, select Dropdown list and give it some meaningful name.
  3. Enter the items, one per line. The number of dropdown items should correspond to the number of nested templates. For example, if you have 3 nested templates for the program levels, you should enter 3 items: Bronze, Silver, and Gold.
  4. Select the For insert-if sections only checkbox, as the dropdown is only needed for validating conditions.
  5. When done, click OK.

Create a dropdown menu for the email template.

For more information, please refer to How to add a dropdown menu to an email template.

4. Create conditions

For each template shortcut listed in your container template, add a condition and link it to a specific item of the dropdown menu. This ensures that the correct template is included based on your choice.

For instance, to configure the condition for the "Bronze" shortcut, perform these steps:

  1. Right-click the ##bronze shortcut and choose Add condition from the context menu. This will open a dialog box, where you set up your condition like shown below.
  2. Under Find in, select WhatToEnter result.
  3. Choose the name of the dropdown menu you created in the previous step.
  4. For the condition, pick "is equal to".
  5. In the Text box, type the text exactly matching the target value in the dropdown menu ("Bronze" in this case).
  6. Click OK when finished.

Repeat these steps to set up conditions for the other nested template shortcuts.
Set up conditions for template shortcuts.

After completing the steps above, your dynamic email template should be fully configured and ready to use. The image below shows the finalized template with three conditions marked with vertical green bar indicators.
Dynamic email template with conditional nested templates

For more details, see How to add a condition based on the WhatToEnter macro result.

Nested conditional email templates in action

And now, the magic part. When using the partner program welcome email template, you are prompted to choose the partnership level from the dropdown list:
Select the partnership level from the dropdown menu.

Upon selecting the desired level, the content of the corresponding nested template is automatically inserted into the message based on the conditions you set up earlier. The inserted content will retain its specific formatting, images, and other elements, resulting in a beautiful custom-tailored welcome email that's ready to send.
A nested email template is automatically inserted into the message based on condition.

So, with these nifty features, creating personalized email templates has never been easier! Give it a try, and watch your emails dynamically adapt to each recipient's unique needs and preferences.

Post a comment

Seen by everyone, do not publish license keys and sensitive personal info!

If you have any questions or issues with this add-in, please feel free to post your concerns in the comments area. As soon as we answer, a notification message will be sent to your e-mail. If you do not want to share your thoughts in public, please contact us at support@ablebits.com.