DataZen Documentation
DataZen User Guide

SEND MAIL

Overview

Sends one or more emails using the SMTP protocol with optional attachments. This operation is data aware and all the string parameters can be composed using variables, DataZen functions, and/or pipeline data.

Attachments are currently only supported for self-hosted environments.

BATCH

The BATCH option is only useful in the context of processing data as part of the current data pipeline. If no data is available, this option is ignored.

If data is available in the pipeline and this is not specified, the BATCH value defaults to 1 when the use of {{...}} is detected in any of the parameters. If set to a value greater than 1, and no DataZen concatenation functions are used (such as @jsonconcat()), the first row of the batch of data will be used and a warning will be raised.

Syntax

Sends one or more emails using the SMTP protocol

SEND EMAIL 
	TO '...,...'
	{ SUBJECT '...' }
	{ BODY '...' }
	{ FROM }
	{ CC '...,...' }
	{ BCC '...,...' }
	{ HTML }
	{ ATTACH '...,...' }
	{ MIME '...' }
	{ BATCH N }
	{ DELAY N }
	{ CONTINUE_ON_ERROR }
	{ SKIP_PREVIEW }
;

FROM

The From email address (optional)

TO

The To email addresses (comma-separated)

SUBJECT

The email subject

BODY

The email body

HTML

When specified, the email will be sent as an HTML document

CC

The email addresses to send as a copy

BCC

The email addresses to send as a blind copy

BATCH

When positive, the number of records to group for each email sent

SKIP_PREVIEW

When specified, the Send Email operation will be skipped during preview operations

DELAY

When positive, the number of seconds to pause between every email sent

ATTACH

Comma-separated list of files to attach (up to 10) using absolute paths

MIME

MIME Type of the attached file(s) (ex: application/pdf)

CONTINUE_ON_ERROR

Continues processing even if errors are detected

Example 1

SEND MAIL [smtp]
  FROM 'email@company.com'
  SUBJECT 'Test'
  BODY 'Test email'
  TO 'email1@company.com,email2@company.com'
;

Example 2

SELECT * FROM DB [sql]
(SELECT TOP 3 name, email, reminder FROM customers);

SEND MAIL [smtp]
  FROM 'email@company.com'
  SUBJECT 'Reminder for {{name}}'
  HTML
  BODY '<html>
  <p>
  Dear {{name}}, <br />
  We would like to remind you of your appointment: <br /><br />
  
  {{reminder}}

  <br /><br />
  Thank you!<br />
  </p>
  </html>'
  TO '{{email}}'

  BATCH 1
  DELAY 1
;