From d21b24bbce4812c2666f22424ccd9017dbc74712 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 19 Jun 2015 22:34:07 +0100 Subject: [PATCH] check header properties in email node to close #118 --- social/email/61-email.js | 6 +++--- social/email/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/social/email/61-email.js b/social/email/61-email.js index 195d390d..dfc594b6 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -202,9 +202,9 @@ module.exports = function(RED) { stream.on('end', function() { if (info.which !== 'TEXT') { var head = Imap.parseHeader(buffer); - pay.from = head.from[0]; - pay.topic = head.subject[0]; - pay.date = head.date[0]; + if (head.hasOwnProperty("from")) { pay.from = head.from[0]; } + if (head.hasOwnProperty("topic")) { pay.topic = head.subject[0]; } + if (head.hasOwnProperty("date")) { pay.date = head.date[0]; } pay.header = head; } else { var parts = buffer.split("Content-Type"); diff --git a/social/email/package.json b/social/email/package.json index 01c63c96..8c77a814 100644 --- a/social/email/package.json +++ b/social/email/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-email", - "version" : "0.0.3", + "version" : "0.0.4", "description" : "Node-RED nodes to send and receive simple emails", "dependencies" : { "nodemailer" : "1.3.4",