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 Trigger to 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 Success True 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

  1. Provide the sender credentials and enable SMTP/API access on the Gmail account.

  2. Fill Subject, Content, Sender Address, Mail API Password, and Receiver Address inputs.

  3. Optionally provide a file path to Attachment File Path for attachments.

  4. Activate the Trigger input to send the message.

  5. Monitor the Success output to confirm delivery.

πŸ’‘ Tips and Tricks

  • To capture and attach an image from a camera, combine this block with Camera USB or Camera IP (ONVIF) and save the frame using Image Write or Image Logger. Provide the saved path to Attachment File Path.

  • If you want to send notifications only once when an event happens, use Rising Edge or Logic Input to create a one-time Trigger pulse.

  • Build message text dynamically using String Merge or prepare structured logs with Data to JSON before sending.

  • When emailing multiple images, use Multi Image Write to 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 Object or Mask Detection to decide when to trigger the email.

πŸ› οΈ Troubleshooting

  • Authentication fails: verify that the Sender Address is enabled for SMTP/API access and that the Mail API Password is correct. Check Gmail account security settings.

  • Attachment not sent: ensure the path in Attachment File Path points 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 Trigger input 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?