Add/Edit Mail Template
On this screen, you can enter or edit the details of a particular mail template.
Mail Template Definition
In this section, enter the following details about the mail template, including:
Template Name - the name of the mail template
From - the full email address of the sender, for example, "myname@domain.com"
Subject - the subject of the email, including template parameters
Email Message Type - choose whether or not the email will be displayed using HTML or plain text
Email Body - the body of the email message. To show actual alerts, you will need to add several template parameters, described in the next section
SMS Body - the body of the SMS message used for users who have requested SMS text message notifications. You can also use template parameters in this field.
Save/Cancel
To save your changes, click "Save" after entering the details above. Or, to discard your changes, press "Cancel".
Diagnostics
To test the mail template, you can enter either an email address and press the "Send Email" button. OptiTune will save the template, and fill it in with some sample events, and send the completed email message to the email address provided. To test the SMS message, enter an SMS mobile phone number, select the mobile phone carrier, and press the "Send SMS" button. OptiTune will again fill in the SMS Body template, and send the text message to the phone number provided.
Mail Template Parameters
In the Subject, Email Body, and SMS Body fields, you can enter "Mail Template Parameters", which will be filled in before the email message or SMS message is sent to a recipient. Below is a listing of all available template parameters. Note that template parameters are enclosed in ‘$' characters, for example, $myparam$. To show only the $ character in an email message, you will need to enter $$ instead of a single $ character.
<table>
<thead>
<tr class="header">
<th>Parameter Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>ToFirstName</td>
<td>The first name of the intended recipient, e.g. "John"</td>
</tr>
<tr class="even">
<td>ToLastName</td>
<td>The last name of the intended recipient, e.g. "Smith"</td>
</tr>
<tr class="odd">
<td>ToFullName</td>
<td>The full name of the intended recipient, e.g. "John Smith"</td>
</tr>
<tr class="even">
<td>ToEmailAddress</td>
<td>The email address of the intended recipient, e.g. "jsmith@gmail.com"</td>
</tr>
<tr class="odd">
<td>ToSMSNumber</td>
<td>The SMS number of the intended recipient, e.g. "555 555-5555"</td>
</tr>
<tr class="even">
<td>OrganizationName</td>
<td>The name of the organization</td>
</tr>
<tr class="odd">
<td>OptiTuneBaseUrl</td>
<td>The base url for OptiTune, without a trailing slash, e.g. "https://manage.opti-tune.com"</td>
</tr>
<tr class="even">
<td>NumAlerts</td>
<td>The total number of alerts described in the alert email</td>
</tr>
<tr class="odd">
<td>AlertsShortSummary</td>
<td>A short summary of the alerts, suitable for an email subject, e.g. "2 critical, 1 warning"</td>
</tr>
<tr class="even">
<td>AlertsHeaderImage</td>
<td>A header image web address which can be shown at the beginning of an alert email</td>
</tr>
<tr class="odd">
<td>ForEachAlertBegin</td>
<td>When this special template parameter is encountered, all text up to the next "ForEachAlertEnd" mail template parameter will be repeated and expanded for each alert. This allows you to provide a simple template for how to display each alert. See the example of ForEachAlertBegin/End below</td>
</tr>
<tr class="even">
<td>ForEachAlertEnd</td>
<td>This special template parameter is not expanded, but indicates the end of an alert sequence. See ForEachAlertBegin above.</td>
</tr>
<tr class="odd">
<td>AlertSeverityIcon</td>
<td>
<p>A URL to an image file for an alert's severity icon.</p>
<p>This parameter can only occur within a ForEachAlertBegin/End section.</p>
</td>
</tr>
<tr class="even">
<td>AlertSeverity</td>
<td>
<p>An individual alert's severity.</p>
<p>This parameter can only occur within a ForEachAlertBegin/End section.</p>
</td>
</tr>
<tr class="odd">
<td>AlertName</td>
<td>
<p>An individual alert's name.</p>
<p>This parameter can only occur within a ForEachAlertBegin/End section.</p>
</td>
</tr>
<tr class="even">
<td>AlertDescription</td>
<td>
<p>An individual alert's description.</p>
<p>This parameter can only occur within a ForEachAlertBegin/End section.</p>
</td>
</tr>
<tr class="odd">
<td>AlertCategories</td>
<td>
<p>An individual alert's list of categories, separated by commas.</p>
<p>This parameter can only occur within a ForEachAlertBegin/End section.</p>
</td>
</tr>
<tr class="even">
<td>AlertComputerOrGroupIcon</td>
<td>
<p>A URL to an image file for a computer or group icon. If the alert is for a computer, it will reference a computer icon, otherwise it will reference a group icon. If the alert is specific to an entire organization, it will be empty.</p>
<p>This parameter can only occur within a ForEachAlertBegin/End section.</p>
</td>
</tr>
<tr class="odd">
<td>AlertComputerOrGroup</td>
<td>
<p>A text label indicating if the alert is for a computer or group.</p>
<p>This parameter can only occur within a ForEachAlertBegin/End section.</p>
</td>
</tr>
<tr class="even">
<td>AlertComputerOrGroupName</td>
<td>
<p>The name of the computer or group that an individual alert pertains to.</p>
<p>This parameter can only occur within a ForEachAlertBegin/End section.</p>
</td>
</tr>
<tr class="odd">
<td>AlertDateTimeLong</td>
<td>
<p>The date and time that the alert occurred, in a long format. If the email is being sent to an OptiTune user account, the user account's time zone will be taken into account in generating this value. Otherwise, the OptiTune server's time zone will be used, typically Pacific Standard Time (PST).</p>
<p>This parameter can only occur within a ForEachAlertBegin/End section.</p>
</td>
</tr>
<tr class="even">
<td>AlertDateTimeShort</td>
<td>Similar to AlertDateTimeLong, except the date and time are in the shorter format, e.g. 11/27/2014 12:03:01 AM</td>
</tr>
<tr class="odd">
<td>FirstAlertSeverityIcon</td>
<td>The value of AlertSeverityIcon for the first alert.</td>
</tr>
<tr class="even">
<td>FirstAlertSeverity</td>
<td>The value of AlertSeverity for the first alert.</td>
</tr>
<tr class="odd">
<td>FirstAlertName</td>
<td>The value of AlertName for the first alert.</td>
</tr>
<tr class="even">
<td>FirstAlertDescription</td>
<td>The value of AlertDescription for the first alert.</td>
</tr>
<tr class="odd">
<td>FirstAlertCategories</td>
<td>The value of AlertCategories for the first alert.</td>
</tr>
<tr class="even">
<td>FirstAlertComputerOrGroupIcon</td>
<td>The value of AlertComputerOrGroupIcon for the first alert.</td>
</tr>
<tr class="odd">
<td>FirstAlertComputerOrGroup</td>
<td>The value of AlertComputerOrGroup for the first alert.</td>
</tr>
<tr class="even">
<td>FirstAlertComputerOrGroupName</td>
<td>The value of AlertComputerOrGroupName for the first alert.</td>
</tr>
<tr class="odd">
<td>FirstAlertDateTimeLong</td>
<td>The value of AlertDateTimeLong for the first alert.</td>
</tr>
<tr class="even">
<td>FirstAlertDateTimeShort</td>
<td>The value of AlertDateTimeShort for the first alert.</td>
</tr>
</tbody>
</table>
ForEachAlertBegin/ForEachAlertEnd
Since there may be one or more alert instances described in an alert email, we need a way to describe how to format a sequence of one or more alerts in the mail template. This is where the special variables $ForEachAlertBegin$ and $ForEachAlertEnd$ come into play.
When expanding a mail template to send a message to a user, when the $ForEachAlertBegin$ parameter is encountered, all text up to the next $ForEachAlertEnd$ parameter is repeated and expanded for each alert. This allows you to basically expand a list of alerts into displayable text.
In the example below, we will expand the list of alerts into rows of an HTML table (one alert per row). Inside the <tbody> HTML tag, you will see the $ForEachAlertBegin$ parameter, followed by several $Alert...$ parameters, and finally ending with the $ForEachAlertEnd$. The text between the $ForEachAlertBegin$ and $ForEachAlertEnd$ parameters will be repeated and expanded for each alert instance, filling in the parameters in green with each alert's information.
<tbody>
$ForEachAlertBegin$
<tr>
<td><img src="$AlertSeverityIcon$" alt="Alert Severity" /></td>
<td>$AlertSeverity$</td>
<td>$AlertName$</td>
<td>$AlertDescription$</td>
<td>$AlertDetails$</td>
<td>$AlertCategories$</td>
<td><img src="$AlertComputerOrGroupIcon$" alt="Computer or Group"/></td>
<td>$AlertComputerOrGroupName$</td>
<td>$AlertDateTimeShort$</td>
</tr>
$ForEachAlertEnd$
</tbody>
Note that if you only want to show the first alert's information, there are several $FirstAlert....$ variables which can be used to accomplish this (see the table above), and these variables are not placed inside a $ForEachAlertBegin/End$ section.