Email Overview
TheEMAIL 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.
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
- Critical alert
- Dynamic recipient
- Report with images
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
TheSMTP_CONFIG block tells the connector which mail server to send through and how to authenticate.
Server Settings
Server Settings
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.Event Configuration
EachADD EVENT block defines a trigger topic and the content of the email it sends.
Trigger & Routing
Trigger & Routing
MQTT topic that receives a confirmation after each email is sent. See Confirming Delivery.
Email Content
Email Content
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.
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.
- Save the template as an
.htmlfile on the broker host, for example/opt/coreflux/templates/critical_alert.html. - If the broker runs in Docker, mount the folder into the container and use the path as seen inside the container.
- Set
TEMPLATE_PATHto that full path.
{"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 aDESTINATION_TOPIC, the connector publishes a JSON confirmation there after each email is handed to the SMTP server:
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
Email Not Sending
Email Not Sending
- Publish a test message to the exact
SOURCE_TOPIC, with a payload that fills every placeholder inSUBJECTandRECIPIENT - Subscribe to
$SYS/Coreflux/Routes/<connector_name>/statusand watcherrors.totalandmessages.failedwhile you send the test - Check the broker log for
Failed to execute eventand 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
587withUSE_TLS "true". Port465isn’t supported - Check the firewall allows outbound SMTP connections from the broker host
- If
DESTINATION_TOPICreceived a confirmation but nothing arrived, check the recipient’s spam folder and the sending account’s outbox
Email Arrives Without the Template
Email Arrives Without the Template
- 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
Email Authentication Failed
Email Authentication Failed
- 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.

