sendEmailUsingTemplate
A Workflow Engine function that sends an email message to a list of recipients using an email server instance defined in the Email Endpoints integration. You can specify the recipients of the email, but the email subject and message body are defined in a template in the Email Endpoints integration.
The sendTo
argument accepts the following:
A comma separated list of email addresses.
The contents of an alert field. For example:
$(custom_info.eventDetails.emailTo)
.For Situations only: a team mapping from the Email Endpoints integration using the $EXPAND(teams) macro. This requires you to configure email for the team mapping in the Email Endpoints integration.
Use $NL
or <br>
to specify line breaks in the message body.
The Add-ons package includes some example workflows to help you get started.
This action is for email only.
This function is available as a feature of the Add-ons v2.1 download and later. See Install Moogsoft Add-ons for information on how to upgrade.
This function is available for alert and Situation workflows.
Back to Workflow Engine Functions Reference.
Arguments
Workflow Engine function sendToEmailUsingTemplate
takes the following arguments:
Name | Required | Type | Description |
---|---|---|---|
| yes | string | Server Config Name from the Email Endpoints integration. It contains the connection information for your email server. |
| yes | string | Message Template Name from the Email Endpoints integration. THe template contains the message subject and body rules for the email message. |
| yes | string | The email destination. A comma separated list of email addresses, the contents of an alert field, or a team maping. |
Example
The following example demonstrates typical use of Workflow Engine function sendEmailUsingTemplate
. The configuration refers to an Email Endpoints integration configuration called "Example." THe email destination depends on a team mapping in the Email Endpoints integration. For example the team ‘Cloud Devops’ is mapped to "devops@example.com".
Set the following:
emailConfig : testing
messageTemplate : defaultSituation
sendTo : $EXPAND(teams)
The defaultSituation template defines 2 settings for the email to be sent, e.g:
Message Subject : AIOps Notification :: A $EXPAND(internal_priority) situation has been raised
Message Body : A $EXPAND(internal_priority) situation has been raised <br> \n Description - $(description) \n \n Service(s) affected are $EXPAND(services) \n \n AIOps situation link :: $CONTEXT_URL(config[servlets.conf][webhost])
The UI translates your settings to the following JSON:
{"emailConfig":"Example","messageTemplate":"defaultSituation","sendTo":"$EXPAND(teams)"}
The action should be set to forward the alert or situation as needed but in most cases it should be set to ‘Stop This Workflow’ on failure.
The function returns false when the request payload was not built successfully.