diff --git a/social/email/61-email.js b/social/email/61-email.js index e3e6a0fa..7294af9e 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -190,7 +190,7 @@ module.exports = function(RED) { // will be used to populate the email. // DCJ NOTE: - heirachical multipart mime parsers seem to not exist - this one is barely functional. function processNewMessage(msg, mailMessage) { - msg = JSON.parse(JSON.stringify(msg)); // Clone the message + msg = RED.util.cloneMessage(msg); // Clone the message // Populate the msg fields from the content of the email message // that we have just parsed. msg.payload = mailMessage.text; @@ -198,9 +198,9 @@ module.exports = function(RED) { msg.date = mailMessage.date; msg.header = mailMessage.headers; if (mailMessage.html) { msg.html = mailMessage.html; } - if (mailMessage.to && mailMessage.from.to > 0) { msg.to = mailMessage.to; } - if (mailMessage.cc && mailMessage.from.cc > 0) { msg.cc = mailMessage.cc; } - if (mailMessage.bcc && mailMessage.from.bcc > 0) { msg.bcc = mailMessage.bcc; } + if (mailMessage.to && mailMessage.to.length > 0) { msg.to = mailMessage.to; } + if (mailMessage.cc && mailMessage.cc.length > 0) { msg.cc = mailMessage.cc; } + if (mailMessage.bcc && mailMessage.bcc.length > 0) { msg.bcc = mailMessage.bcc; } if (mailMessage.from && mailMessage.from.length > 0) { msg.from = mailMessage.from[0].address; } if (mailMessage.attachments) { msg.attachments = mailMessage.attachments; } else { msg.attachments = []; } diff --git a/social/email/package.json b/social/email/package.json index 985817e0..07a9289a 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,11 +1,11 @@ { "name": "node-red-node-email", - "version": "1.0.0", + "version": "1.0.1", "description": "Node-RED nodes to send and receive simple emails", "dependencies": { "imap": "^0.8.19", "mailparser": "^0.6.2", - "nodemailer": "^4.6.4", + "nodemailer": "^4.6.8", "poplib": "^0.1.7" }, "repository": {