4 min readUpdated Mar 2, 2026

sendEmail Documentation

Purpose

The sendEmail logic is designed to facilitate the sending of emails containing the output data of a workflow. Utilizing Intuidy's internal email service (noreply@intuidy.com), it allows users to configure email recipients, subject lines, and email body templates. This logic streamlines communication by ensuring relevant workflow results are promptly shared with specified recipients.

Settings

The sendEmail function has various settings that dictate the behavior and appearance of the emails sent. Below is a detailed explanation of each setting.

1. Recipient Configuration (to)

2. Email Subject (subject)

3. Body Template (bodyTemplate)

4. Body Format (bodyFormat)

How It Works

  1. Input Processing: The function first retrieves the input data (inputs.input1) to be included in the email body.
  2. Recipient Validation: It processes the recipient email(s) from the configuration, trims whitespace, and checks for valid email formats. If the recipient(s) aren’t valid or exceed the maximum count of 50, an error is thrown.
  3. Email Body Generation: Depending on available configurations, the body is either taken from a custom template (if provided) or generated using smart auto-formatting.
  4. Email Sending: Finally, it calls the internal sendWorkflowEmail service to dispatch the email to the specified recipients, utilizing the configured subject and body.
  5. Output Handling: The function returns a success report containing the email details.

Data Expectations

The sendEmail logic expects the following data structure for inputs:

Use Cases & Examples

Use Cases

  1. Automated Reporting: A marketing department may set up a workflow that generates weekly sales reports. By using sendEmail, the team can automatically email these reports to key stakeholders every Friday.

  2. Notification System: An IT operations team can implement sendEmail as part of a workflow that triggers alerts when system thresholds are breached, ensuring prompt responses to critical issues.

  3. Client Updates: In a client-services context, firms can utilize sendEmail to communicate project updates or important information directly to clients as part of their workflow processes.

Detailed Example

Use Case: Automated Weekly Sales Reporting

Scenario: An e-commerce firm wants to send a weekly sales summary every Friday to the sales team.

Configuration Data:

json
{
    "inputs": {
        "input1": {
            "salesData": [
                {"date": "2023-10-02", "revenue": 5000},
                {"date": "2023-10-03", "revenue": 7000}
            ]
        }
    },
    "config": {
        "to": "sales_team@example.com, manager@example.com",
        "subject": "Weekly Sales Report",
        "bodyTemplate": "<h1>Weekly Sales Summary</h1><p><strong>Details:</strong></p><pre>{{salesData}}</pre>",
        "bodyFormat": "html"
    }
}

In this example, the email will be sent to two recipients, containing the title "Weekly Sales Report" and a formatted summary of the sales data in HTML format. Each weekly report can adapt its content based on the dynamically generated input1 data from the workflow.