add option to set criteria witch type of emails should be requested (#519)

This commit is contained in:
Wolfgang Rathgeb
2019-02-11 20:26:45 +01:00
committed by Dave Conway-Jones
parent 31b9cc1f61
commit aa684240d8
3 changed files with 36 additions and 2 deletions

View File

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