Skip to main content

Send Mail

Sends an email with the specified subject, body, and attachments.

To learn how to send email watch the following Loom video:

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

if ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.

Input

  • Client Id - The client id required to send the email. The ID is created by the Connect node.
  • From - The email address the email should be sent from.
  • To - The email address(es) the email should be sent to.
  • Cc - The email address(es) to be Cc'd in the email.
  • Bcc - The email address(es) to be Bcc'd in the email.
  • Reply To - The email address that should be used as the reply-to address.
  • Subject - The subject of the email.
  • Body - The body of the email.

Output

  • n/a - No output

Options

  • Credentials - The credentials required to send the email. Required if there is no Client Id.
  • Is Body HTML - Indicates whether the Body is in HTML format.
  • Attachments - The attachments to the email. Must be an array of full paths (e.g. ["C:\Users\Jane\Documents\report.xlsx", "C:\Users\Jane\Documents\invoices.xlsx"])
  • Custom Attachments - Custom attachments to the email. Attachment full paths can be added one by one (e.g. C:\Users\Jane\Documents\report.xlsx)

How It Works

The Send Mail node sends emails through SMTP with support for various features. Here's the step-by-step process:

  1. Authentication Selection - Uses either Client ID from Connect node or direct credentials
  2. Recipient Validation - Ensures at least one recipient is specified (To, CC, or BCC)
  3. Email Construction - Builds the email with headers, body, and attachments
  4. Attachment Processing - Attaches files from specified paths, supporting embedded images
  5. Reply/Forward Handling - If in reply/replyall/forward mode, fetches original email and constructs proper headers
  6. SMTP Connection - Connects to SMTP server using Basic Auth or OAuth2
  7. Email Transmission - Sends the email through the SMTP server
  8. Threading Headers - Adds In-Reply-To and References headers for email threading

Requirements

To use the Send Mail node, you need:

  • Client ID from Connect node OR Credentials from vault
  • From Email Address - Must be a valid email address
  • At least one recipient - To, CC, or BCC must be specified
  • SMTP Server Access - Server settings in credentials (typically port 587 with STARTTLS or port 465 with SSL)
  • Attachments (optional) - Valid file paths if including attachments
  • Original Email (for reply/forward modes) - Reply To Mail ID in format "INBOX/12345"

Error Handling

Error CodeDescriptionResolution
Core.Mail.Send.ErrOnCreateConfiguration parsing failedCheck node configuration
Core.Mail.Send.ErrCredentialsInvalid or missing credentialsVerify vault credentials are selected
Core.Mail.Send.ErrNoFromValueFrom field is emptyProvide sender email address
Core.Mail.Send.ErrNoRecipientNo recipients specifiedAdd at least one recipient in To, CC, or BCC
Core.Mail.Send.ErrDialAndSendFailed to send emailCheck SMTP server settings and network connectivity
Core.Mail.Send.ErrClientIdClient ID not foundVerify Connect node executed successfully
Core.Mail.Send.ErrNoSMTPSMTP settings missingAdd SMTP server settings to credentials
Core.Mail.Send.ErrInvalidModeInvalid message modeUse 'new', 'reply', 'replyall', or 'forward'
Core.Mail.Send.ErrMissingMailIDReply To Mail ID requiredProvide mailbox UID for reply/forward modes
Core.Mail.Send.ErrGetOriginalMailCannot fetch original emailVerify Reply To Mail ID is valid
Core.Mail.Send.ErrCustomAttachmentAttachment file not foundCheck file path exists and is accessible
Core.Mail.ErrConnConnection missingEnsure Connect node was executed or credentials provided

Usage Examples

Example 1: Send Simple Text Email

// Using Client ID from Connect node
{
"client_id": "{{client_id}}",
"from": "sender@example.com",
"to": "recipient@example.com",
"subject": "Monthly Report",
"body": "Please find the monthly report attached.",
"is_body_html": false
}

// Output: Email sent successfully

Example 2: Send HTML Email with Attachments

{
"client_id": "{{client_id}}",
"from": "automation@company.com",
"to": "team@company.com, manager@company.com",
"cc": "stakeholder@company.com",
"subject": "Weekly Analytics Report",
"body": "<h1>Weekly Report</h1><p>See attached files.</p>",
"is_body_html": true,
"attachments": [
"C:\\Reports\\weekly_analytics.pdf",
"C:\\Reports\\charts.xlsx"
]
}

Example 3: Reply to Email with Quoted Content

// First, get the original email using Get Mail or Search Mail
// Original email has mailbox UID: "INBOX/12345"

{
"client_id": "{{client_id}}",
"from": "support@company.com",
"reply_to_mail_id": "INBOX/12345", // Format: MAILBOX/UID
"subject": "Re: Customer Inquiry", // Optional - auto-generated if empty
"body": "Thank you for your inquiry. We'll look into this.",
"message_mode": "reply",
"include_original_message": true, // Quotes original message
"quote_style": "gmail" // Options: gmail, outlook, simple
}

// The original message will be quoted below your reply

Example 4: Forward Email with All Attachments

{
"client_id": "{{client_id}}",
"from": "admin@company.com",
"to": "team@company.com",
"reply_to_mail_id": "INBOX/98765",
"body": "FYI - please review this.",
"message_mode": "forward",
"include_original_message": true,
"include_original_attachments": true // Includes all attachments from original
}

Example 5: Send Email with Embedded Images (HTML)

{
"client_id": "{{client_id}}",
"from": "newsletter@company.com",
"to": "subscribers@company.com",
"subject": "Monthly Newsletter",
"body": "<html><body><h1>Welcome!</h1><img src='cid:logo.png'/></body></html>",
"is_body_html": true,
"custom_attachments": ["C:\\Images\\logo.png"] // Will be embedded as cid:
}

Usage Notes

  • Multiple Recipients: Separate multiple email addresses with commas in To, CC, or BCC fields
  • HTML vs Plain Text: Set is_body_html to true for HTML emails, false for plain text
  • Embedded Images: Images can be embedded in HTML emails using Content-ID references
  • Reply Threading: Use reply_to_mail_id for proper email threading (keeps conversation together)
  • Message Modes:
    • new or empty: Send new email
    • reply: Reply to sender only
    • replyall: Reply to sender and all original recipients
    • forward: Forward to new recipients
  • Quote Styles: Choose between gmail, outlook, or simple quoting formats
  • Attachment Paths: Must be absolute paths accessible from the robot's machine
  • OAuth2 vs Basic: Both authentication methods work transparently
  • SMTP Ports: Port 587 (STARTTLS) or 465 (SSL) are standard
  • BCC Privacy: BCC recipients are hidden from other recipients

Tips

  • Test Email Addresses: Use test email addresses during development to avoid sending to real users
  • Validate Attachments: Check that all file paths exist before sending to avoid errors
  • HTML Safety: Sanitize HTML content if it comes from user input to prevent XSS
  • Large Attachments: Be mindful of email server attachment size limits (typically 25MB for Gmail, 35MB for Outlook)
  • Error Handling: Use Try-Catch blocks to handle send failures gracefully
  • Reply-To Header: Use the reply_to field to specify a different reply address
  • Email Threading: Always include reply_to_mail_id for replies to maintain conversation threads
  • Batch Sending: For mass emails, add delays between sends to avoid rate limiting
  • Template Emails: Use variable substitution in subject and body for personalized emails
  • Delivery Tracking: Check sent folder or use email tracking services for delivery confirmation