Breadcrumbs

Customizing Email Templates with IF & EACH

IF Conditions

IF Conditions are used to apply conditions to email templates, enabling further customization of individual templates. IF Conditions can be utilized in all email templates, whether they are system templates or custom templates. Do you need to display specific texts, placeholders, or images in a confirmation email, for instance, but only for certain participants? IF Conditions provide this capability.

Structure of IF Conditions

Example: IF Condition

{IF?VAR = VAL} Example Text {ENDIF}

A condition always begins with {IF? then a variable follows (VAR) with its corresponding value (VAL) {IF?VAR = VAL}. After the value VAL the curly bracket must be closed again before inserting the text, placeholder, or image. The following operators are available for comparing variables and values:

  • = Equals

  • > Greater than

  • < Less than

  • >= Greater than or equal to

  • <= Less than or equal to

  • != Not equal to

  • IN List,
    Example: {IF?OfferName IN Kayak Course 1, Kayak Course 2, Kayak Course 3} it is comma-separated.

  • {IF?UseZ = } empty

Do you want to incorporate an ELSE clause into the IF → THEN condition {ELSE} Do you want to incorporate? Do not yet close the condition with {ENDIF}, but instead, after the desired output, add{ELSE} , then the alternative text, and only then {ENDIF}.

Example: IF Condition with ELSE

{IF?VAR = VAL} Example Text {ELSE} Alternative Text {ENDIF}


Use Cases for IF Conditions

Below are use cases illustrating where and how IF Conditions can be applied.

IF Conditions with Tags

Do you have text that you only wish to include, for instance, with online events? First, assign the tag «online» to all online events. This tag will then be utilized for the IF Condition.

Example of what the IF Condition could look like:

{IF?OfferTags IN online} This text is only displayed if the offer has the «Online» tag assigned {ENDIF}

Besides text, you also have the option to output an image; instead of text, simply insert the desired image via the edoobox File Manager:

{IF?OfferTags IN online}<img src="https://wwwdata.edoobox.com/filemanager/Bild.jpg" alt="" width="200" height="300"/>{ENDIF}

Tip: Different Backgrounds for Certificates

Do you have different images that you would like to use as a background in a certificate, for instance? IF Conditions can also be applied for this purpose.

Utilize the example above, where the image is rendered based on the tag assigned to an offer. If you wish to render a different image as a background in another offer, you can insert the exact same IF Condition again into the certificate template. Adjust the corresponding offer tag and insert the next image.

{IF?OfferTags IN präsenz}<img src="https://wwwdata.edoobox.com/filemanager/Bild2.jpg" alt="" width="200" height="300"/>{ENDIF}

IF Conditions with Placeholder

Do you have specific information for participants from another country? Insert the placeholder ##UserCountry## (without ## ) and assign the corresponding value to the placeholder.

Example of what the IF Condition could look like:

{IF?UserCountry = Schweiz} This is specific information for participants from Switzerland {ENDIF}

Additionally, extend the IF Condition with an {ELSE}statement:

{IF?UserCountry = Schweiz} This is specific information for participants from Switzerland {ELSE} This is the information for all other participants {ENDIF}

IF Conditions with custom data fields

Do you have custom data fields that you wish to apply in an IF Condition, for instance, to differentiate information for participants of a specific age group? Fundamentally, this application example operates similarly to placeholders; the sole distinction is that you create a dedicated placeholder for the custom data field rather than utilizing an existing one. The process is detailed in the linked documentation on custom data fields.

Example of what the IF Condition could look like:

{IF?UserAlter >= 18} This is specific information for participants aged 18 or older {ENDIF}

{IF?UserAlter < 18} Dies sind spezifische Informationen für Teilnehmende jünger als 18 Jahre {ENDIF}

{IF?OfferStartDate = $[OfferEndDate]} Date is identical ##OfferStartDate## {ELSE} Dates are different ##OfferStartDate## - ##OfferEndDate##{ENDIF}

IF Conditions with Additional text blocks

Do you have a supplementary text block within an offer that should only be sent to a subset of participants? As demonstrated in the placeholder example, first utilize a placeholder and then populate it with the corresponding value.

Example of what the IF Condition could look like:

{IF?UserCountry = Switzerland} ##OfferConfirmationText1## {ENDIF}

IF Conditions with true and false values for the inquiry list

The placeholder ##OfferlistSecondMailExists## can be utilized within an IF condition to verify if a secondary email address is stored for a booking. If present, the inquiry will additionally be dispatched to a second recipient. A prerequisite for this functionality is that the relevant participant data field for capturing the secondary email address has been selected in the global email settings.

Example:

{IF?OfferlistSecondMailExists = true}Text for the second email address is included here{ENDIF}

image-20250214-132655.png
Global Settings | Email | Settings: Select participant data field for second email address


EACH Loop

The EACH loop is utilized, for instance, to list all participants of a group registration within the Registration Info Mail.

With {EACH?BookingUsers} the loop is initiated, with {ENDEACH} closed. Additionally, these placeholders are available within the loop:

  1. ##Id##

  2. ##Salutation##

  3. ##Firstname##

  4. ##Lastname##

  5. ##Email##

  6. ##Pricecategory##

Within the loop, only active participants of the booking are displayed; contact persons are not listed.

Insert the following code directly into the email template:

{EACH?BookingUsers} ##Firstname## ##Lastname## {ENDEACH}

The names of the group participants are displayed side-by-side. After the placeholder, ##Lastname## add a comma if you want the names to be clearly separated.

Example: Listing names vertically

If you want the names of the group participants to be listed vertically rather than horizontally in the email sent to you, add a <br/> after the last placeholder in the source code within the EACH loop:

Source Code

<p>{EACH?BookingUsers} ##Firstname## ##Lastname##, ##UserEmail##<br/>{ENDEACH}</p>

Snag_5e3d5d23.png
Registration Info Email: Enhancement with an EACH loop for a quick overview


Related Guides

Keywords for this guide

Email Templates ¦ IF Conditions ¦ Tags ¦ Placeholders ¦ Additional Text Blocks ¦ Data Fields ¦ EACH Loop ¦ Conditions