Skip to main content

Email Overview

The EMAIL route sends templated emails in response to MQTT messages. It’s the simplest way to turn a broker event — a critical alarm, a daily report, a user notification — into a message that reaches a person’s inbox.
Like an auto-reply rule in your mailbox. When a message lands on a topic you’re watching, the route fills in a template and sends the email for you — no manual step required.

When to use it

  • Alert an operations team the moment a critical alarm fires.
  • Email a stakeholder a daily or shift report.
  • Notify an individual user using an address pulled from the message payload.

Let’s look at how to define an email route, starting with the most common scenarios.

Quick Start

Send an immediate alert to a fixed team address when a critical event arrives:
DEFINE ROUTE CriticalAlerts WITH TYPE EMAIL
    ADD SMTP_CONFIG
        WITH HOST "smtp.gmail.com"
        WITH PORT '587'
        WITH USERNAME "alerts@company.com"
        WITH PASSWORD "app-password-here"
        WITH USE_TLS "true"
    ADD EVENT criticalNotify
        WITH SOURCE_TOPIC "alerts/critical/+"
        WITH TEMPLATE_PATH "/templates/critical_alert.html"
        WITH SUBJECT "CRITICAL: {value.json.alert_type}"
        WITH RECIPIENT "ops-team@company.com"
For Gmail, use an App Password instead of your regular password. Enable 2FA on your Google account first.

SMTP Configuration

The SMTP_CONFIG block tells the route which mail server to send through and how to authenticate.
HOST
string
required
SMTP server address (e.g., smtp.gmail.com, smtp.office365.com).
PORT
integer
required
SMTP port (typically 587 for TLS, 465 for SSL).
USE_TLS
boolean
Enable TLS encryption. Recommended: true.
USERNAME
string
required
Email account to send from.
PASSWORD
string
required
Email password or app-specific password.

Event Configuration

Each ADD EVENT block defines a trigger topic and the content of the email it sends.
SOURCE_TOPIC
string
MQTT topic to trigger email sending.
DESTINATION_TOPIC
string
MQTT topic to publish send status.
TEMPLATE_PATH
string
Path to HTML email template file.
SUBJECT
string
Email subject line (supports placeholders).
RECIPIENT
string
Email recipient address (supports placeholders).

Template Placeholders

Subjects, recipients, and templates support placeholders that are filled in from the triggering message:
PlaceholderDescription
{value}Full JSON payload as string
{value.json.field}Single field from JSON
{value.json.nested.field}Nested field access

Troubleshooting

  • Verify SMTP credentials are correct
  • For Gmail, ensure you’re using an App Password
  • Check firewall allows outbound SMTP connections
  • Verify recipient email address is valid
  • Double-check USERNAME and PASSWORD
  • Ensure 2FA is enabled if using app passwords
  • Some providers require enabling “less secure apps” access
  • Check for account lockouts due to failed attempts

Next Steps

MQTT Bridge

Sync topics between two MQTT brokers.

Data Storage Routes

Store MQTT data in databases.
Last modified on July 3, 2026