emailTemplate
The emailTemplate
data type describes the emailTemplate
property of the emailNotification
data type.
Properties
The table below describes the properties included in the emailTemplate
data type.
Property | Data type | Description | Notes |
body | String |
Specifies the format of the body of the email messages HCPsends when email notification is enabled. Valid values include any combination of plain text and email template variables. Plain text can include spaces and line breaks but not tabs. The character sequence consisting of a backslash (\) followed by a lowercase n creates a line break. | To change the body in the email template to blank, include the from and subject properties in the request body and omit the body property. |
from | String |
Specifies the content of the email From line. Valid values include any combination of plain text and email template variables and must have the form of a valid email address. Some email servers require that the value in the From line be an email address that is already known to the server. | If this property is included in the request body, the subject property must also be included. |
subject | String |
Specifies the content of the email Subject line. Valid values include any combination of plain text and email template variables. Plain text can include spaces but not line breaks or tabs. | If this property is included in the request body, the from property must also be included. |
Variables
The values you specify for the body, from, and subject properties of the emailTemplate
data type can include variables that correspond to the information available for each log message (for example, the severity of the event that triggered the message or the short description of the event). When sending email, HCP replaces the variables in the email message with the applicable information.
To include a variable in the email template, you specify the variable name preceded by the dollar sign ($). A dollar sign followed by anything other than a variable name is displayed as a dollar sign in the email HCP sends.
The list below lists the variables you can use in the email template.
$action
The action to take in response to the message
$date
The date and time at which the event occurred (for example, Wed Feb 8 2017 3:15:57 PM EST)
$fullText
The full text of the message
$id
The message ID
$location
The fully qualified name of the HCP system on which the event occurred (for example, hcp-ma.example.com)
$origin
For user-initiated events, the IP address from which the event request was sent and the port through which HCP received the event request, separated by a colon (for example, 192.168.152.181:8000)
$reason
The reason why HCP issued the message
$severity
The severity of the event that triggered the message
$shortText
A brief description of the event that triggered the message
$type
The type of message (General, Security, or Compliance), preceded by Important and a comma if the message is important (for example, Important, Security)
$user
The user ID and username of the event initiator (for example, 105ff38f-4770-4f98-b5b3-8371ab0af359 lgreen)
Defaults
The list below shows the format of the default email template.
From
log@$location
Subject
[$severity] $shortText
Body
The following event occurred on $date: $fullText Reason: $reason Action: $action Details: User: $user Origin: $origin
Example
Here’s an XML example of the emailTemplate
data type:
<emailTemplate> <from>log@$location</from> <body>A message was written to the tenant log on $date.\n\n$reason\n\n $action</body> <subject>$severity - $shortText</subject> </emailTemplate>