Skip to main content

SMTP Sink Node

The smtpsink node sends an email via SMTP for each pipeline record, building recipients, subject, and body from record fields using template expressions.

Each record that passes through the sink triggers one email. Recipients, subject, and body are specified as templates that support {{$.field}} placeholders, allowing the email content to be fully dynamic based on record data. STARTTLS is enabled by default for encrypted transport.

Key Features

  • Per-record email sending: each pipeline record triggers one outbound email
  • Template expressions: use {{$.field}} placeholders in toTemplate, ccTemplate, subjectTemplate, and bodyTemplate to build dynamic content from record fields
  • HTML and plain text support: set bodyContentType to text/html for rich HTML emails or text/plain for simple text
  • STARTTLS support: encrypted transport via STARTTLS is enabled by default

Configuration

FieldTypeRequiredDefaultDescription
hostStringYesSMTP server hostname
portIntegerNo587SMTP server port
credentialIdStringYesID of username/password credentials in jobContext.otherProperties.
fromAddressStringYesSender email address (e.g. alerts@example.com)
toTemplateStringYesTemplate expression for recipient(s). Supports {{$.field}} placeholders.
ccTemplateStringNoTemplate expression for CC recipients. Supports {{$.field}} placeholders.
subjectTemplateStringYesTemplate for the email subject. Supports {{$.field}} placeholders.
bodyTemplateStringYesTemplate for the email body. Supports {{$.field}} placeholders.
bodyContentTypeStringNotext/plainMIME type of the body (text/plain or text/html)
useTlsBooleanNotrueEnable STARTTLS

Template Expressions

Template fields support {{$.field}} placeholders that are evaluated against each pipeline record at runtime. For example, given a record:

{
"alert_email": "oncall@example.com",
"severity": "CRITICAL",
"host": "web-server-01",
"message": "Disk usage exceeded 90%"
}

The following configuration produces a fully dynamic email per record:

config:
fromAddress: "alerts@example.com"
toTemplate: "{{$.alert_email}}"
subjectTemplate: "Alert: {{$.severity}} on {{$.host}}"
bodyTemplate: "Host {{$.host}} reported: {{$.message}}"
bodyContentType: "text/plain"

This would send an email to oncall@example.com with the subject Alert: CRITICAL on web-server-01 and the body Host web-server-01 reported: Disk usage exceeded 90%.

DAG Example

jobContext:
otherProperties:
smtp-cred:
username: alerts@example.com
password: mypassword
metricTags: {}
dlqConfig:

dag:
- id: "source"
commandName: "stdin"
config:
encodingType: "JSON_OBJECT"
outputs:
- "sink"

- id: "sink"
commandName: "smtpsink"
config:
host: "smtp.example.com"
port: 587
credentialId: "smtp-cred"
fromAddress: "alerts@example.com"
toTemplate: "{{$.alert_email}}"
subjectTemplate: "Alert: {{$.severity}} on {{$.host}}"
bodyTemplate: "Host {{$.host}} reported: {{$.message}}"
bodyContentType: "text/plain"
useTls: true
  • imapsource: Poll an IMAP mailbox and emit each email as an record
  • sqssink: Send pipeline records as messages to an SQS queue