diff --git a/social/email/61-email.html b/social/email/61-email.html index eb20cacd..b678a0eb 100644 --- a/social/email/61-email.html +++ b/social/email/61-email.html @@ -57,6 +57,7 @@ +
@@ -171,6 +172,27 @@ +
+ + +

@@ -199,9 +221,11 @@ if (protocol === "IMAP") { $(".node-input-box").show(); $(".node-input-disposition").show(); + $(".node-input-criteria").show(); } else { $(".node-input-box").hide(); $(".node-input-disposition").hide(); + $(".node-input-criteria").hide(); } checkPorts(); }); @@ -252,6 +276,7 @@ port: {value:"993",required:true}, box: {value:"INBOX"}, // For IMAP, The mailbox to process disposition: { value: "Read" }, // For IMAP, the disposition of the read email + criteria: {value: "UNSEEN"}, repeat: {value:"300",required:true}, fetch: {value:"auto"}, inputs: {value:0} diff --git a/social/email/61-email.js b/social/email/61-email.js index 8e466901..2ae4206e 100644 --- a/social/email/61-email.js +++ b/social/email/61-email.js @@ -160,6 +160,7 @@ module.exports = function(RED) { this.useSSL= n.useSSL; this.protocol = n.protocol || "IMAP"; this.disposition = n.disposition || "None"; // "None", "Delete", "Read" + this.criteria = n.criteria || "UNSEEN"; // "ALL", "ANSWERED", "FLAGGED", "SEEN", "UNANSWERED", "UNFLAGGED", "UNSEEN" var flag = false; @@ -343,7 +344,7 @@ module.exports = function(RED) { return; } else { - imap.search([ 'UNSEEN' ], function(err, results) { + imap.search([ this.criteria ], function(err, results) { if (err) { node.status({fill:"red", shape:"ring", text:"email.status.foldererror"}); node.error(RED._("email.errors.fetchfail", {folder:node.box}),err); diff --git a/social/email/locales/en-US/61-email.json b/social/email/locales/en-US/61-email.json index 702e6492..4f8b4bdb 100644 --- a/social/email/locales/en-US/61-email.json +++ b/social/email/locales/en-US/61-email.json @@ -20,7 +20,15 @@ "disposition": "Disposition", "none": "None", "read": "Mark Read", - "delete": "Delete" + "delete": "Delete", + "criteria": "Criteria", + "all": "All", + "answered": "Answered", + "flagged": "Flagged", + "seen": "Seen", + "unanswered": "Unanswered", + "unflagged": "Unflagged", + "unseen": "Unseen" }, "default-message": "__description__\n\nFile from Node-RED is attached: __filename__", "tip": {