Enviar Email Personalizado

Enviar correos electrónicos con encabezados personalizados a través de SMTP.

Overview

This node allows sending customized emails via SMTP with support for personalized headers, multiple formats (plain text, HTML, or both), attachments, calendar invitations, and advanced email options. It is useful in scenarios where automated email notifications, marketing campaigns, or transactional emails need to be sent with fine-grained control over content and headers.

Practical examples include:

  • Sending newsletters with both HTML and plain text versions.
  • Dispatching calendar event invitations (.ics files).
  • Adding custom headers like unsubscribe links for compliance.
  • Using a test mode to send emails to a specific address before going live.
  • Including attachments dynamically from previous workflow steps.

Properties

Name Meaning
From Email Sender's email address.
To Email Recipient email addresses, comma-separated if multiple.
Asunto Subject line of the email.
Formato De Correo Email format: "Texto" (plain text only), "HTML" (HTML only), or "Ambos" (both plain text and HTML).
Mensaje (Texto) Plain text message body; shown if format is "Texto" or "Ambos".
Mensaje (HTML) HTML message body; shown if format is "HTML" or "Ambos".
Activar Encabezados Personalizados Enable defining custom email headers in JSON format.
Encabezados Personalizados (JSON) Custom email headers as JSON key-value pairs, e.g., unsubscribe links.
Modo De Prueba If enabled, sends emails to a test address instead of real recipients.
Email De Prueba Test email address to receive all emails when test mode is active.
Prefijo Del Asunto Prefix added to the subject line in test mode; if empty, original subject is used.
Opciones Collection of additional options:
- Adjuntos Comma-separated file paths for attachments.
- Correo BCC Blind carbon copy recipient emails, comma-separated.
- Correo CC Carbon copy recipient emails, comma-separated.
- Evento De Calendario (ICS) Content of an .ics calendar invitation to attach.
- Fecha Personalizada Custom date/time for the email.
- Ignorar Problemas SSL (Inseguro) Whether to ignore SSL certificate validation errors when connecting to SMTP server.
- In-Reply-To Message-ID this email replies to.
- Incluir créditos del autor Append a credit line ("Desarrollado por Cristianemek") at the end of the email body.
- Prioridad Email priority: Normal, Alta (high), Baja (low).
- Referencias Comma-separated list of message IDs referenced by this email.
- Reply-To Email Email address for reply-to header.

Output

The node outputs an array of items corresponding to each input item processed. Each output item contains a json object with the result of the email sending operation, including:

  • Details returned by the SMTP transport after sending (e.g., accepted recipients, messageId).
  • A testMode boolean indicating if the email was sent in test mode.
  • If in test mode, an originalRecipient object showing the intended To, CC, BCC, and Reply-To addresses replaced by the test email.

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.
  • Optional: Access to binary data in input items if attachments are specified by binary property names.

Troubleshooting

  • Invalid JSON in Custom Headers: If custom headers JSON is malformed, the node throws an error "Custom Headers must be valid JSON". Ensure the JSON syntax is correct.
  • Invalid Email Addresses: The node validates email formats for To, Test Email, CC, BCC, and Reply-To fields. Invalid emails will cause errors or rejection by SMTP.
  • Attachment Issues: If attachment file names do not match binary properties in input, the node will fail asserting binary data. Verify attachment names correspond to existing binary properties.
  • SSL Certificate Errors: If connecting to SMTP fails due to SSL issues, enable "Ignorar Problemas SSL (Inseguro)" to bypass certificate validation (not recommended for production).
  • Test Mode Misconfiguration: When test mode is enabled but no test email is provided, emails may not send correctly. Always specify a valid test email address.
  • SMTP Authentication Failures: Check credentials and SMTP server settings if authentication errors occur.

Links and References

Discussion