SendMail 10Kcodeurs icon

SendMail 10Kcodeurs

Envoie des emails via SMTP avec sauvegarde optionnelle et gestion avancée

Overview

This node enables sending emails via SMTP with advanced options such as multiple recipients, CC/BCC, attachments, custom headers, and email format selection (plain text, HTML, or both). It also supports saving sent emails locally in JSON and/or EML formats for record-keeping.

Common scenarios include:

  • Automated notification emails from workflows.
  • Sending reports or alerts with attachments.
  • Marketing or transactional emails requiring rich formatting.
  • Archiving sent emails for compliance or auditing.

Example use cases:

  • Sending a welcome email to new users with both HTML and plain text versions.
  • Dispatching invoices as PDF attachments to clients.
  • Sending alert emails with high priority and custom headers for integration with other systems.

Properties

Name Meaning
From Email Sender's email address (required).
From Name Sender's name (optional).
To Email Recipient email address(es), comma-separated (required).
CC Email Email address(es) for carbon copy (optional).
BCC Email Email address(es) for blind carbon copy (optional).
Subject Subject line of the email (required).
Email Format Format of the email content: Plain Text, HTML, or Both.
Text Plain text version of the email (required if format is Plain Text or Both).
HTML HTML version of the email (required if format is HTML or Both).
Attachments One or more attachments to include, each defined by:
- Property Name: binary property containing data
- File Name: name of the attachment file
- Content-ID: for inline images in HTML (optional)
Options Additional email options including:
- Custom Headers: add arbitrary headers
- Priority: Low, Normal, High
- Reply To: reply email address
- Return Path: bounce handling address (optional)
- Save Sent Email: whether to save the sent email locally
- Save Format: JSON, EML, or Both (if saving)
- Save Path: directory path to save emails
- Timeout (Seconds): max time to wait for sending

Output

The node outputs a JSON object per input item with the following structure:

  • messageId: The unique ID of the sent message.
  • accepted: List of accepted recipient addresses.
  • rejected: List of rejected recipient addresses.
  • response: Server response string after sending.
  • envelope: Envelope details used for sending.
  • success: Boolean indicating if sending succeeded.
  • timestamp: ISO timestamp of when the email was sent.

If sending fails and "Continue On Fail" is enabled, output includes:

  • error: Error message describing the failure.
  • success: false
  • timestamp: ISO timestamp of failure.

No binary data is output by this node.

Dependencies

  • Requires an SMTP server credential configured in n8n with host, port, security, username, and password.
  • Uses the nodemailer library internally to send emails.
  • Node.js filesystem access to optionally save sent emails locally.
  • No external API dependencies beyond SMTP.

Troubleshooting

  • Missing required fields: Errors occur if From Email, To Email, or Subject are empty. Ensure these are provided.
  • Content missing for selected format: If "Plain Text" or "HTML" format is selected, corresponding content must be filled; otherwise, an error is thrown.
  • Attachment errors: Attachment property names must match existing binary properties in input data; otherwise, an error occurs.
  • Timeouts: Sending may fail if SMTP server does not respond within the configured timeout (default 30 seconds).
  • Saving errors: If the save path is invalid or not writable, saving the sent email will fail with an error.
  • SMTP connection issues: Connection test method can verify credentials; failures indicate incorrect SMTP settings or network issues.

To resolve common errors:

  • Double-check all required inputs.
  • Verify SMTP credentials and connectivity.
  • Confirm binary data exists for attachments.
  • Adjust timeout if needed.
  • Ensure save directory permissions.

Links and References

Discussion