@gemini86/node-red-sendgrid 1.1.4
Sending e-mail node using SendGrid service
@gemini86/node-red-sendgrid
Send e-mails using the SendGrid service from Node-RED. This node provides a reliable alternative to the default e-mail node, especially when using cloud or remote deployments.
Inputs
- msg.from (
string): Sender e-mail address - msg.to (
string): Recipient e-mail address - msg.cc (
string, optional): Carbon copy recipient(s) - msg.bcc (
string, optional): Blind carbon copy recipient(s) - msg.topic or msg.subject (
string): E-mail subject - msg.payload (
string): E-mail body (plain text or HTML) - msg.attachments (
Buffer | Array | Object): One or more attachments. Use a Buffer for a single attachment, or an array of Buffers/objects for multiple. Objects must match SendGrid's attachment format. Filenames are auto-generated unless provided. - msg.templateId (
string, optional): SendGrid dynamic template ID - msg.templateData (
objectorstring, optional): Data for dynamic template
Details
To use this node:
- Install via the Node-RED palette manager (
@gemini86/node-red-sendgrid). - Get an API key from SendGrid.
- Paste the API key into the node's configuration.
- Configure your flow to set the required message properties.
Attachments
To add attachments, set msg.attachments:
- For a single attachment, use a Buffer.
- For multiple attachments, use an array of Buffers or objects in SendGrid's format.
- If using Buffers, filenames will be auto-generated unless you provide
att.filenameormsg.filenames(array of names in the same order as the Buffers). msg.payloadis always used as the e-mail body (string or HTML), never as an attachment.
SendGrid attachment object example:
{
content: "<base64-encoded string>",
filename: "document.pdf",
type: "application/pdf", // optional
disposition: "attachment", // optional
content_id: "unique-id" // optional
}
Skip Bad Attachments
If enabled, attachments that cannot be normalized (invalid or unsupported) will be skipped and a warning will be logged instead of failing the node. If disabled, the node will error on the first bad attachment.
Note: Legacy usage of msg.payload as a Buffer for attachments is no longer supported. Always use msg.attachments for attachments.