Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Mail templates are written in the Velocity Template Language, or VTL (official documentation). It is basically HTML with some (simple) logic possibilities and enables the user to create custom templates based on its needs.

Table of Contents

Introduction

...

Code Block
languagexml
titleAn excerpt from the default template
#if($bookings.size() ne 1)
#set ($bookingQ = "These bookings match")
#else
#set ($bookingQ = "This booking matches")
#end
<p>${bookingQ}:</p>
<table>
#foreach($booking in $bookings)
	<tr>
		<td>$booking.campaignId</td>
		<td><a href="${origin}#campaignDetail/bookingDetail/${booking.Id}/${booking.campaignId}"> ${booking.Id} </a></td>
	</tr>
#end
</table>

This The above example can translate to the following result that shows which bookings match the alert:

It enables the user to create custom templates, based on the needs.

Possibilities

As you can see, you can You can add internal info into to the template , as well as some logic.

 

Info

Parameters are prefixed with $, and commands with #.

Setting parameters

The basic syntax for setting a parameter is:

#set ($parameter = "value")

...

The value of the parameter can be a simple string, integer, calculation or concatenation. More info in the following Documentation

If-else constructs

The syntax for an if-else statement is:

Code Block
#if(condition)
  >run if true<
#elseif(second condition)
  >run if first condition if false and second true<
...
#else
  >run if no previous conditions is true<
#end

...

Parameter nameMeaning
$booking.idAn integer representing the booking ID
$booking.campaignidAn integer representing the booking campaign ID
$booking.nameA string representing the booking name
$booking.descriptionA string representing the booking description
$booking.toReachVolumeAn integer representing the booking to reach volume
$booking.startDateA Date date representing the booking start date
$booking.endDateA Date date representing the booking end date
$booking.startTimeA LocalTime representing the booking start time
$booking.endTimeA LocalTime representing the booking end date
$booking.daysOfTheWeekOnlineAn integer Set set representing the days of the week online (monday -> 1, tuesday -> 2, ..., sunday -> 7)
$booking.deliveryMethod.value()A string object representing the booking delivery method: "auto", "sov" or "rotation"
$booking.deliveryMultiples.value()A string representing the booking delivery multiples: "all-together", "one-at-a-time" or "free"
$booking.creationA Date date representing the booking creation date
$booking.lastModifiedA Date date representing the date of the last booking modification
$booking.slot.idAn integer representing the booking slot idID
$booking.slot.nameA string representing the booking slot name
$booking.waveIdAn integer representing the booking wave idID
$booking.pricingCodeA string representing the booking pricing code: "cpm", "cpc", "cpp", " adm" or "cpl"

Alert

This contains all the information about the alert fired:

...

All objects represent their Java counterparts, which means that you can use any Java method supported by that object.E

Code Block
titlee.g. a string
Code Block
<p>This is a
#if ($alert.name.substring(0,1) == "!")
	high
#elseif ($alert.name.substring(0,1) == "-")
    low
#else
    medium
#end
priority alert.</p>