Back to Step Functions

sendEmail

Beginner

Sends custom emails with dynamic content, HTML formatting, and recipient lists for notifications, reports, and automated communications.

overview

The sendEmail function enables Vibes to send custom emails with dynamic content, allowing workflows to notify users, send reports, or deliver processed information via email.

Send emails with custom subject lines, HTML content, and recipient lists to keep stakeholders informed, deliver results, and maintain communication throughout automated processes.

HTML Support: The sendEmail function supports full HTML formatting in the body parameter, enabling rich formatting, tables, links, and professional email layouts.

Key Features

Dynamic Content

  • Variable interpolation from workflow steps
  • Seamless integration with workflow data
  • Full HTML formatting support
  • Conditional content based on results

Recipient Management

  • Multiple recipient support (CC/BCC)
  • CC and BCC functionality
  • Dynamic recipient extraction from data
  • Built-in email validation

input_parameters

ParameterTypeRequiredDescription
to_emailstringPrimary recipient email address
subjectstringEmail subject line
bodystringEmail content (supports HTML formatting)
cc_listarrayOptionalList of CC recipient email addresses
bcc_listarrayOptionalList of BCC recipient email addresses

Output Structure

Success Response

{ "success": true }

Basic Usage

Simple Notification Email

Basic email notification with static content:

Basic Email Example

Advanced Usage with Dynamic Content

Dynamic Content and Recipients

Advanced email with dynamic content, multiple recipients, and variable interpolation:

Advanced Email Example

Global Variable Integration

Using global variables for consistent email configuration across workflows:

Global Variable Email Example

Integration Patterns

sendEmail works seamlessly with other Vibes functions to create comprehensive communication workflows:

Combined with aiExtractVariables

Extract recipient information and custom messages from conversations:

Combined with createHtmlTable

Send formatted data tables in email reports:

Combined with scheduleFlow for Recurring Emails

Set up automated recurring email reports:

Error Handling

The sendEmail function includes comprehensive error handling to ensure reliable email delivery:

Error Handling Example

Common Error Scenarios

Invalid Email Addresses

Malformed or non-existent email addresses will cause delivery failures

Delivery Failures

Network issues or recipient server problems can prevent delivery

Content Formatting Issues

Invalid HTML or character encoding can affect email display

Best Practices

Email Content & Formatting

Create professional, well-formatted emails that clearly communicate your message.

  • Use HTML formatting for better presentation and readability
  • Include clear subject lines that indicate the email's purpose
  • Provide context about why the email was sent automatically
  • Include relevant data and timestamps for reference

Error Prevention

Prevent errors and ensure reliable schedule cancellation operations.

  • Always include error handling for email steps using on_error_step_id
  • Validate email addresses before attempting to send
  • Provide fallback communication methods when email fails
  • Test email deliverability during development

Recipient Management

Manage email recipients effectively while respecting privacy and communication preferences.

  • Use dynamic recipient extraction from workflow data
  • Validate email format and handle invalid addresses gracefully
  • Handle multiple recipients appropriately with CC and BCC
  • Respect privacy by using BCC for bulk notifications

Content Optimization

Optimize email content for clarity, professionalism, and cross-client compatibility.

  • Keep email content concise while including necessary information
  • Use professional formatting and appropriate tone
  • Include actionable information and clear next steps
  • Test email rendering across different email clients

Common Use Cases

Workflow Completion Notifications

Notify users when automated processes complete:

Alert and Monitoring

Send system alerts and monitoring notifications:

Report Distribution

Distribute automated reports to stakeholders:

Related Functions

These functions complement sendEmail for building comprehensive communication and reporting workflows: