You are here: Administration Guide > CMS > Email Templates > Conditional Tags

Conditional Tags

One or more parts of an email template can be removed by wrapping the section in conditional email tags.

A conditional email tag is different from a normal email tag because it starts and ends with curly braces (”{“ and “}”) followed by a question mark, instead of the usual square braces (“[“ and “]“). The email tag [Detail.ShippingAmount] is normally replaced with a value such as “9.95” when the email is sent out. If there is no shipping, then the tag would be replaced with “0.00”, but would still be shown in the email.

Using conditional tags it is possible to remove the surrounding text if it is not applicable.

Example:
{?Detail.ShippingAmount}Shipping Amount: [Detail.ShippingAmount] {?end}

In this case, if the shipping is zero then none of the text “Shipping Amount: 0.00“ would be displayed in this email. If the shipping amount is greater than zero then all of the text “Shipping Amount: 9.95” would be displayed.

To go a step further, the {?else} tag can be incorporated.

Example:
{?Receiver.IsVerified}
<p>Hello, [Receiver.FirstName]</p>
{?else}
<p>Howdy, stranger</p>
{?end}

Any site property can become a dynamic aspect of the email template.

Example:
{?#UserMessagingEnabled} … text to show if setting is true … {?else} …optional text to show if false … {?end}
You can also just use the simplified form:
{?#UserMessagingEnabled} … text to show if setting is true … {?end}

You can replace “UserMessagingEnabled” with the name of any non-date site property in any email template.