diff --git a/social/email/61-email.html b/social/email/61-email.html
index f62ff0c3..960d22ab 100644
--- a/social/email/61-email.html
+++ b/social/email/61-email.html
@@ -147,7 +147,7 @@
diff --git a/social/email/61-email.js b/social/email/61-email.js
index c1509918..b0bd91b5 100644
--- a/social/email/61-email.js
+++ b/social/email/61-email.js
@@ -183,17 +183,13 @@ module.exports = function(RED) {
msg.payload = mailMessage.text;
msg.topic = mailMessage.subject;
msg.date = mailMessage.date;
- if (mailMessage.html) {
- msg.html = mailMessage.html;
- }
- if (mailMessage.from && mailMessage.from.length > 0) {
- msg.from = mailMessage.from[0].address;
- }
- if (mailMessage.attachments) {
- msg.attachments = mailMessage.attachments;
- } else {
- msg.attachments = [];
- }
+ 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.from && mailMessage.from.length > 0) { msg.from = mailMessage.from[0].address; }
+ if (mailMessage.attachments) { msg.attachments = mailMessage.attachments; }
+ else { msg.attachments = []; }
node.send(msg); // Propagate the message down the flow
} // End of processNewMessage
@@ -322,11 +318,13 @@ module.exports = function(RED) {
return;
}
+ var marks = false;
+ if (this.disposition === "Read") { marks = true; }
// We have the search results that contain the list of unseen messages and can now fetch those messages.
var fetch = imap.fetch(results, {
bodies: '',
struct: true,
- markSeen : true
+ markSeen: marks
});
// For each fetched message returned ...
@@ -357,10 +355,10 @@ module.exports = function(RED) {
node.status({});
imap.end();
};
- if (this.disposition == "Delete") {
+ if (this.disposition === "Delete") {
imap.addFlags(results, "\Deleted", cleanup);
- } else if (this.disposition == "Read") {
- imap.addFlags(results, "\Answered", cleanup);
+ } else if (this.disposition === "Read") {
+ imap.addFlags(results, "\Seen", cleanup);
} else {
cleanup();
}
diff --git a/social/email/package.json b/social/email/package.json
index bdd2a2e8..130d6236 100644
--- a/social/email/package.json
+++ b/social/email/package.json
@@ -1,12 +1,12 @@
{
"name": "node-red-node-email",
- "version": "0.1.12",
+ "version": "0.1.13",
"description": "Node-RED nodes to send and receive simple emails",
"dependencies": {
"nodemailer": "^1.11.0",
"poplib": "^0.1.7",
- "mailparser": "^0.6.0",
- "imap": "^0.8.17"
+ "mailparser": "^0.6.1",
+ "imap": "^0.8.19"
},
"repository": {
"type": "git",