Skip to main content

sendEmail

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, subject, and message body for the email in the function arguments.

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. See sendEmailUsingTemplate for an example.

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 sendToEmail takes the following arguments:

Name

Required

Type

Description

emailConfig

yes

string

The Server Config Name from the Email Endpoints integration. It contains the connection information for your email server.

sendTo

yes

string

The email destination. A comma separated list of email addresses, the contents of an alert field, or a team maping.

subject

yes

string

Email subject. Supports macro substitution.

message

yes

string

Email message body. Supports macro substitution.

Example

The following example demonstrates typical use of Workflow Engine function sendToEmail. The configuration refers to an Email Endpoints integration configuration called "Example."

Set the following:

  • emailConfig : Example

  • sendTo : tester@example.com, example@example.com

  • subject : AIOps ACTION REQUIRED :: $EXPAND(internal_priority) situation has been raised - please review

  • message : A $EXPAND(internal_priority) situation has been raised $NL $NL Description - $(description) $NL $NL Service(s) affected are $EXPAND(services) $NL $NL AIOps situation link :: $CONTEXT_URL(config[servlets.conf][webhost])

The UI translates your settings to the following JSON:

{"emailConfig":"Example","sendTo":"tester@example.com,example@example.com","subject":"AIOps ACTION REQUIRED :: $EXPAND(internal_priority) situation has been raised - please review","message":"A $EXPAND(internal_priority) situation has been raised $NL $NL Description - $(description) $NL $NL Service(s) affected are $EXPAND(services) $NL $NL AIOps situation link :: $CONTEXT_URL(config[servlets.conf][webhost])"}

The sendToEmail action forwards alerts or Situations as needed. It is set to "Stop This Workflow" on failure. Returns false if the request payload is not successfully built.