Send Mail
This function block lets you send emails using Gmail SMTP. It is intended for sending plain-text messages and optional file attachments from workflows. The block expects the sender account to be enabled for Gmail API / SMTP access.
π₯ Inputs
Subject - The email subject text (string).
Content - The body content of the email (string).
Sender Address - The Gmail address that will send the message (string). Must be configured for SMTP/API use.
Mail API Password - The password or API key used for authenticating the sender address (string).
Receiver Address - The destination email address (string).
Attachment File Path - Optional full file path to attach to the email (string). Leave empty if no attachment.
Trigger - Boolean signal that initiates sending when active.
π€ Outputs
Success - Boolean indicating whether the send action succeeded.
πΉοΈ Controls
Send - There is no separate send button; sending is initiated by providing an active Trigger to the block. Configure message fields via inputs.
βοΈ Running Mechanism
The block waits for inputs to be provided and for the
Triggerto become active.When triggered, it attempts to authenticate the provided sender account and send the message to the receiver.
Attachments are included when a valid file path is provided.
The block returns
SuccessTrue on successful send, False otherwise.If authentication or delivery fails due to a transient issue, the block will attempt to reconnect and resend automatically.
β¨ Features
Sends plain-text emails via Gmail SMTP.
Supports a single file attachment by file path.
Uses a cached session to avoid re-authenticating on every trigger when possible.
Automatic reconnect and retry on transient session issues.
π Usage Instructions
Provide the sender credentials and enable SMTP/API access on the Gmail account.
Fill
Subject,Content,Sender Address,Mail API Password, andReceiver Addressinputs.Optionally provide a file path to
Attachment File Pathfor attachments.Activate the
Triggerinput to send the message.Monitor the
Successoutput to confirm delivery.
π‘ Tips and Tricks
To capture and attach an image from a camera, combine this block with
Camera USBorCamera IP (ONVIF)and save the frame usingImage WriteorImage Logger. Provide the saved path toAttachment File Path.If you want to send notifications only once when an event happens, use
Rising EdgeorLogic Inputto create a one-timeTriggerpulse.Build message text dynamically using
String Mergeor prepare structured logs withData to JSONbefore sending.When emailing multiple images, use
Multi Image Writeto store images then attach from file paths (one at a time as supported).For sending event snapshots as part of analysis pipelines, combine with analysis blocks such as
Find ObjectorMask Detectionto decide when to trigger the email.
π οΈ Troubleshooting
Authentication fails: verify that the
Sender Addressis enabled for SMTP/API access and that theMail API Passwordis correct. Check Gmail account security settings.Attachment not sent: ensure the path in
Attachment File Pathpoints to an existing file and is accessible from the runtime environment.Email not delivered: check receiver address spelling and spam/junk folders. Network restrictions or firewalls may block SMTP ports.
Trigger ignored: confirm the
Triggerinput receives an explicit True value (or a rising edge) at runtime.Session expired: the block will attempt to reconnect automatically, but if persistent failures occur, re-check credentials and network connectivity.
π Privacy & Security
Do not store sensitive passwords in shared projects. Use secure secrets handling where possible.
Limit the sender account privileges and enable appropriate security measures on the Gmail account used for sending.
Last updated
Was this helpful?