Skip to main content

Email Overview

The EMAIL connector 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 connector 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 connector, starting with the most common scenarios.

Quick Start

Send an immediate alert to a fixed team address when a critical event arrives:
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 connector which mail server to send through and how to authenticate.
string
required
SMTP server address (e.g., smtp.gmail.com, smtp.office365.com).
integer
SMTP port. Defaults to 587. The connector secures the connection with STARTTLS, so use 587 (or 25). Port 465, which expects TLS from the first byte, isn’t supported.
boolean
Upgrade the connection with STARTTLS. Defaults to true.
string
required
Account used to sign in to the SMTP server. It’s also the sender (From) address.
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.
string
MQTT topic to trigger email sending.
string
MQTT topic that receives a confirmation after each email is sent. See Confirming Delivery.
string
Path to the HTML template file on the machine (or container) that runs the broker. Use an absolute path. If the file can’t be found, the email is still sent, with the raw message payload as its body.
string
Email subject line (supports placeholders).
string
Email recipient address (supports placeholders). Required: if it resolves to an empty value, the email isn’t sent.

Template Placeholders

Subjects, recipients, and templates support placeholders that are filled in from the triggering message:

Template Files

TEMPLATE_PATH points at a file the broker reads from its own file system. It is not uploaded with your LoT code, and it isn’t read from the computer where you write the connector.
  1. Save the template as an .html file on the broker host, for example /opt/coreflux/templates/critical_alert.html.
  2. If the broker runs in Docker, mount the folder into the container and use the path as seen inside the container.
  3. Set TEMPLATE_PATH to that full path.
If the path is wrong, nothing fails: the email arrives with the raw payload (for example {"alert_type":"overheat"}) as its body. That is the quickest sign that the broker can’t see your template.

Confirming Delivery

When an event has a DESTINATION_TOPIC, the connector publishes a JSON confirmation there after each email is handed to the SMTP server:
Wildcards in DESTINATION_TOPIC are filled from the matching levels of SOURCE_TOPIC, as with other connectors. Nothing is published to DESTINATION_TOPIC when a send fails. Failures are recorded in the broker log (Failed to execute event '<event>' in route '<connector>': <reason>) and in the connector status topic, $SYS/Coreflux/Routes/<connector_name>/status. See Connector Status Monitoring.

Troubleshooting

  • Publish a test message to the exact SOURCE_TOPIC, with a payload that fills every placeholder in SUBJECT and RECIPIENT
  • Subscribe to $SYS/Coreflux/Routes/<connector_name>/status and watch errors.total and messages.failed while you send the test
  • Check the broker log for Failed to execute event and read the reason that follows
  • If the reason is Event '<name>' has no RECIPIENT, the recipient placeholder resolved to nothing. Check the field name in {value.json.field} against the payload
  • Verify SMTP credentials are correct. For Gmail, use an App Password
  • Use port 587 with USE_TLS "true". Port 465 isn’t supported
  • Check the firewall allows outbound SMTP connections from the broker host
  • If DESTINATION_TOPIC received a confirmation but nothing arrived, check the recipient’s spam folder and the sending account’s outbox
  • The body shows the raw payload when the broker can’t find the file at TEMPLATE_PATH
  • Use the full path on the broker host, not on your own computer
  • In Docker, use the path inside the container and make sure the folder is mounted
  • See Template Files
  • 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

LoT Actions

Publish the MQTT events that trigger notifications.

Data Storage Connectors

Store MQTT data in databases.
Last modified on December 4, 2026