mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Email node - better handling of criteria errors
This commit is contained in:
parent
245109940c
commit
761bb30ada
@ -291,6 +291,12 @@
|
||||
that.inputs = 0;
|
||||
}
|
||||
});
|
||||
$("#node-input-criteria").change(function() {
|
||||
if ($("#node-input-criteria").val() === "_msg_") {
|
||||
$("#node-input-fetch").val("trigger");
|
||||
$("#node-input-fetch").change();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
@ -393,6 +393,8 @@ module.exports = function(RED) {
|
||||
var criteria = ((node.criteria === '_msg_')?
|
||||
(msg.criteria || ["UNSEEN"]):
|
||||
([node.criteria]));
|
||||
if (Array.isArray(criteria)) {
|
||||
try {
|
||||
imap.search(criteria, function(err, results) {
|
||||
if (err) {
|
||||
node.status({fill:"red", shape:"ring", text:"email.status.foldererror"});
|
||||
@ -466,6 +468,22 @@ module.exports = function(RED) {
|
||||
}
|
||||
}); // End of imap->search
|
||||
}
|
||||
catch(e) {
|
||||
node.status({fill:"red", shape:"ring", text:"email.status.bad_criteria"});
|
||||
node.error(e.toString(),e);
|
||||
s = ss = false;
|
||||
imap.end();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
node.status({fill:"red", shape:"ring", text:"email.status.bad_criteria"});
|
||||
node.error(RED._("email.errors.bad_criteria"),msg);
|
||||
s = ss = false;
|
||||
imap.end();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}); // End of imap->openInbox
|
||||
}); // End of imap->ready
|
||||
node.status({fill:"grey",shape:"dot",text:"node-red:common.status.connecting"});
|
||||
|
@ -54,7 +54,8 @@
|
||||
"sending": "sending",
|
||||
"sendfail": "send failed",
|
||||
"parseerror": "Failed to parse message",
|
||||
"connecterror": "connect error"
|
||||
"connecterror": "connect error",
|
||||
"bad_criteria": "Invalid criteria"
|
||||
},
|
||||
"errors": {
|
||||
"nouserid": "No e-mail userid set",
|
||||
@ -66,7 +67,8 @@
|
||||
"parsefail": "Failed to parse message",
|
||||
"messageerror": "Fetch message error: __error__",
|
||||
"refreshtoolarge": "Refresh interval too large. Limiting to 2147483 seconds",
|
||||
"invalidattachment": "Invalid attachment content. Must be String or buffer"
|
||||
"invalidattachment": "Invalid attachment content. Must be String or buffer",
|
||||
"bad_criteria": "Criteria must be a JSON array. See info."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "node-red-node-email",
|
||||
"version": "1.12.2",
|
||||
"version": "1.12.3",
|
||||
"description": "Node-RED nodes to send and receive simple emails.",
|
||||
"dependencies": {
|
||||
"imap": "^0.8.19",
|
||||
"poplib": "^0.1.7",
|
||||
"mailparser": "^3.2.0",
|
||||
"nodemailer": "~6.6.2",
|
||||
"nodemailer": "~6.6.3",
|
||||
"smtp-server": "^3.9.0"
|
||||
},
|
||||
"bundledDependencies": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user