sendmail
Sends input data as an email using the system SMTP configuration.
Command properties
| Property | Description |
|---|---|
| Command type | Transforming |
| Required permission | Administrator |
| License usage | N/A |
| Parallel execution | Supported |
| Distributed execution | Not supported |
Syntax
Options
html=BOOL- When set to
t, sends the email body in HTML format.
Input fields
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Required | Recipient email address. Separate multiple addresses with commas (,). |
subject | string | Required | Email subject. |
message | string | Required | Email body. |
cc | string | Optional | CC email address. Separate multiple addresses with commas (,). |
bcc | string | Optional | BCC email address. Separate multiple addresses with commas (,). |
Output fields
| Field | Type | Description |
|---|---|---|
_sendmail_fail | string | Error reason if the email failed to send. This field is not set when delivery succeeds. |
Error codes
Parsing errors
| Error code | Message | Description |
|---|---|---|
| 31100 | No SMTP configuration for sendmail. | The system SMTP configuration has not been set up. |
| 31101 | sendmail command requires administrator permission. | A user without administrator privileges attempted to run the command. |
Runtime errors
N/A
Description
The sendmail command sends one email per input record. It reads the to, subject, and message fields from each record to construct the recipient, subject, and body. If cc and bcc fields are present, they are added as CC and BCC recipients.
If a required field (to, subject, message) is missing, or if an email address lacks a domain part (@), the email is not sent and the error reason is written to the _sendmail_fail field. If the mail queue is full, queue full is written to the _sendmail_fail field.
Regardless of whether delivery succeeds, the input record is passed to the next command unchanged.
Because the command requires a system SMTP configuration, you must first configure the SMTP server in the system settings of the web console.
Examples
-
Send a plain-text email
json "[{'to': 'admin@example.com', 'subject': 'Alert', 'message': 'Disk usage exceeded 90%'}]" | sendmailSends a plain-text email using the
to,subject, andmessagefields. -
Send an HTML email
json "[{'to': 'admin@example.com', 'subject': 'Report', 'message': '<h1>Daily Report</h1><p>Total events: 1024</p>'}]" | sendmail html=tSends the email body in HTML format using the
html=toption. -
Send with CC and BCC
json "[{'to': 'admin@example.com', 'cc': 'manager@example.com', 'bcc': 'audit@example.com', 'subject': 'Security Alert', 'message': 'Unauthorized access detected'}]" | sendmailSends the email simultaneously to CC and BCC recipients along with the primary recipient.