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

Video: 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.

Video: 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.

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. Under Find in, keep Message fields selected.

    • 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.
    Adding a condition

    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.

Tip. You can combine several conditions with the AND and OR logical operators by selecting the corresponding buttons.
The AND and OR buttons

In this way, you can add complex conditions to sections in your templates. For example, a paragraph will be inserted along with the whole template if the To field contains a specific domain and the subject contains a specific word or phrase, or the To field contains the same domain and the message body contains another specific word or phrase.
An example of a complex condition

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 сondition.
    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. 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.
    Adding a condition

    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. You can use the AND and OR buttons to combine conditions.

    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.