Shared Email Templates for Microsoft Outlook

Insert-if sections: Add, change, and remove conditions

You can add a condition to a paragraph, a list, a list item, a table, or a table row and get this section inserted into an email message along with the whole template only when the condition is met. A section that you've added a condition to becomes an Insert-if section.

To get a quick Insert-if Sections cheat sheet, click the button below.

Download cheat sheet

How to add conditions to different parts of a template

How to add conditions to different parts of a template

In this video, we explain step by step how to automatically insert part of your template into a message only if a specific condition is met.

Run time: 03:53

How to add a regex condition to a template part

How to add a regex condition to a template part

With this video, you'll learn how to insert a section of an email template into your message based on a regular expression condition.

Run time: 03:21

How to add a condition

You can base your condition on some text in an email message field or on the result returned by the WhatToEnter macro.

Adding a condition based on text in a message field

  1. Start creating or editing your template, right-click a section that you want to add a condition to (a paragraph, a list, a list item, a table, or a table row), and then select Add Condition.
    The Add Condition option

    Note. If you select several paragraphs or list items, right-click, and then select Add Condition, your condition will be added to each of the selected paragraphs or list items separately. So, if you decide to change the condition later on, you'll have to change it for each of the paragraphs or list items individually.

  2. The Add condition dialog will appear. Under Find in, select Message field.

    • Choose fields that will be checked for your condition: body, from, to, cc, bcc, subject, location, recipient's or sender's first, last, or full name.
    • Select the condition itself: "contains", "doesn't contain", "contains any of", "contains none of", "is equal to", "is equal to any of", "is equal to none of", "is empty", "is not empty", "matches regex", or "doesn't match regex".
    • Enter the text or regular expression that the add-in will look for when checking whether your condition is met.

    Click OK.
    The Add condition dialog

    Note. You can select the Case-sensitive checkbox for such conditions as "contains", "doesn't contain", "contains any of", "contains none of", "is equal to", "is equal to any of", and "is equal to none of".

    The Case-sensitive checkbox

  3. The section that your condition is applied to will be marked with a green indicator. Save your template.
    A green indicator in a template

    Note. If you add a condition to a list item, you won't be able to add a condition to the whole list, and vice versa. If you add a condition to a table row, you won't be able to add a condition to the whole table, and vice versa.

    Note. If you copy a paragraph from another source and paste it into your template, <p> tags might be missing there, and it won't be possible to add a condition to such a paragraph.

When you insert such a template into an email message, the add-in checks the specified email message field(s) for the condition and the section that the condition is applied to is inserted only if the condition is met.
The condition is met, and the section is inserted.

Adding a condition based on the WhatToEnter macro result

  1. In a template you're creating or editing, right-click a section where a condition is needed: a paragraph, a list, a list item, a table, or a table row. Then select Add Condition.
    The Add Condition option

    Note. If you select several paragraphs or list items, right-click, and then select Add Condition, your condition will be added to each of the selected paragraphs or list items separately. So, if you decide to change the condition later on, you'll have to change it for each of the paragraphs or list items individually.

  2. In the Add condition dialog (under Find in), select WhatToEnter result.

    • Choose a WhatToEnter macro that will be checked for your condition. There must be at least one WhatToEnter macro with the Text field, Dropdown list, or Dataset option in your template. The Date and Time options of the WhatToEnter macro are not supported.
    • Select the condition itself: "contains", "doesn't contain", "contains any of", "contains none of", "is equal to", "is equal to any of", "is equal to none of", "is empty", "is not empty", "matches regex", or "doesn't match regex".
    • Enter the text or regular expression that the add-in will look for when checking whether your condition is met.

    When you're done, click OK.
    The Add condition dialog

    Note. You can select the Case-sensitive checkbox for such conditions as "contains", "doesn't contain", "contains any of", "contains none of", "is equal to", "is equal to any of", and "is equal to none of".

    The Case-sensitive checkbox

    Tip. To avoid inserting the result returned by the WhatToEnter macro into an email message along with the whole template and use that result to simply check your condition, select the For Insert-if sections only checkbox when inserting the WhatToEnter macro into your template.
    The For Insert-if sections only checkbox

  3. A green indicator shows the section that your condition is applied to. Click Save.
    A green indicator in a template

    Note. If you add a condition to a list item, you won't be able to add a condition to the whole list, and vice versa. If you add a condition to a table row, you won't be able to add a condition to the whole table, and vice versa.

    Note. If you copy a paragraph from another source and paste it into your template, <p> tags might be missing there, and it won't be possible to add a condition to such a paragraph.

When inserting such a template into an email message, you'll see a WhatToEnter macro dialog prompting you to select or enter some data. As soon as you do that and click OK, the data you've selected or entered—the WhatToEnter result—will be checked for the condition you applied.
The WhatToEnter macro dialog

If the condition is met, the section that the condition is applied to will be inserted into the email message along with the whole template.
The condition is met, and the section is inserted.

How to change a condition

If you want to modify a condition, right-click the section it's applied to and opt for Change Condition.
The Change Condition option

After you make the necessary changes, save them.

How to remove a condition

Right-click a section where the condition is not needed. Then select the Remove Condition option.
The Remove Condition option

After removing the condition, save your changes.

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.