mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
refix email attachments array
This commit is contained in:
parent
4697636055
commit
1c256fd3b3
@ -119,15 +119,16 @@ module.exports = function(RED) {
|
|||||||
else {
|
else {
|
||||||
var payload = RED.util.ensureString(msg.payload);
|
var payload = RED.util.ensureString(msg.payload);
|
||||||
sendopts.text = payload; // plaintext body
|
sendopts.text = payload; // plaintext body
|
||||||
if (/<[a-z][\s\S]*>/i.test(payload)) {
|
if (/<[a-z][\s\S]*>/i.test(payload)) {
|
||||||
sendopts.html = payload; // html body
|
sendopts.html = payload; // html body
|
||||||
if (msg.hasOwnProperty("plaintext")) {
|
if (msg.hasOwnProperty("plaintext")) {
|
||||||
var plaintext = RED.util.ensureString(msg.plaintext);
|
var plaintext = RED.util.ensureString(msg.plaintext);
|
||||||
sendopts.text = plaintext; // plaintext body - specific plaintext version
|
sendopts.text = plaintext; // plaintext body - specific plaintext version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg.attachments && Array.isArray(msg.attachments)) {
|
if (msg.attachments) {
|
||||||
sendopts.attachments = msg.attachments;
|
if (!Array.isArray(msg.attachments)) { sendopts.attachments = [ msg.attachments ]; }
|
||||||
|
else { sendopts.attachments = msg.attachments; }
|
||||||
for (var a=0; a < sendopts.attachments.length; a++) {
|
for (var a=0; a < sendopts.attachments.length; a++) {
|
||||||
if (sendopts.attachments[a].hasOwnProperty("content")) {
|
if (sendopts.attachments[a].hasOwnProperty("content")) {
|
||||||
if (typeof sendopts.attachments[a].content !== "string" && !Buffer.isBuffer(sendopts.attachments[a].content)) {
|
if (typeof sendopts.attachments[a].content !== "string" && !Buffer.isBuffer(sendopts.attachments[a].content)) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-email",
|
"name": "node-red-node-email",
|
||||||
"version": "1.10.1",
|
"version": "1.11.0",
|
||||||
"description": "Node-RED nodes to send and receive simple emails.",
|
"description": "Node-RED nodes to send and receive simple emails.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user