sendemail

This command is experimental

Definition

sendemail command generates an email notification when the alert is triggered and sends it to a specified email address or several email addresses. The email contains the link to the notebook from where the notification was sent.

Teragrep instance doesn’t include an SMTP server. You need one to be able to send an email.

Examples

SMTP Server Configuration

You can configure the SMTP server connection from a notebook with the following config set:

%spark.conf
dpl.smtp.username=abc
dpl.smtp.password=def
dpl.smtp.server=smtp.server.net:25
dpl.web.url=http://url.com
dpl.pth_10.transform.sendemail.restrictedMode=true|false
dpl.pth_10.transform.sendemail.parameter.from=no-reply@teragrep.com
dpl.smtp.encryption=PLAIN|SSL|TLS

The config list contains the following items:

  • dpl.smtp.username

    Sets the username

  • dpl.smtp.password

    Sets the password

  • dpl.smtp.server

    Sets the server url

  • dpl.web.url

    Defines the site url that is sent in the notification email; by default, the url will be localhost:8080

  • dpl.pth_10.transform.sendemail.restrictedMode

    Restricts sendemail command’s parameters to subject and to, options are TRUE and FALSE

  • dpl.pth_10.transform.sendemail.parameter.from

    Defines the sender’s address, you can define this with from parameter as well

  • dpl.smtp.encryption

    Defines the encryption, options are PLAIN, SSL and TLS

You can configure more than this, but this config set is the bare minimum.

Send the Notification Email

To be able to send a notification email, you need to include to="" parameter. You can include one or more email addresses in the parameter by separating addresses with a comma.

index=example earliest=-3y
| sendemail to="example@email.com"

The email notification is sent every time when someone runs the paragraph.

Set the Sender for the Email

You can define the sender for the notification email by using from="" parameter. If you’ve already configured this with spark.conf interpreter, the parameter will override the configuration.

%dpl
index=example earliest=-3y
| sendemail to="example@email.com" from="no-reply@teragrep.com"

Set the Subject for the Email

You can set a subject for the notification email with subject="". By default, the subject in the notification email will be 'Teragrep Results'.

index=example earliest=-3y
| sendemail to="example@email.com" subject="Teragrep alert: alert name"

Set the Email Message

This feature is not yet implemented but will come in the future.

Further Reading