check header properties in email node

to close #118
This commit is contained in:
Dave Conway-Jones
2015-06-19 22:34:07 +01:00
parent fc05ddd035
commit d21b24bbce
2 changed files with 4 additions and 4 deletions

View File

@@ -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");