mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
email - show valid folders in error if fetch fails
This commit is contained in:
parent
973fd8c6ec
commit
d3a3bc158c
@ -341,15 +341,27 @@ module.exports = function(RED) {
|
|||||||
ss = true;
|
ss = true;
|
||||||
node.status({fill:"blue", shape:"dot", text:"email.status.fetching"});
|
node.status({fill:"blue", shape:"dot", text:"email.status.fetching"});
|
||||||
//console.log("> ready");
|
//console.log("> ready");
|
||||||
// Open the inbox folder
|
// Open the folder
|
||||||
imap.openBox(node.box, // Mailbox name
|
imap.openBox(node.box, // Mailbox name
|
||||||
false, // Open readonly?
|
false, // Open readonly?
|
||||||
function(err, box) {
|
function(err, box) {
|
||||||
//console.log("> Inbox err : %j", err);
|
//console.log("> Inbox err : %j", err);
|
||||||
//console.log("> Inbox open: %j", box);
|
//console.log("> Inbox open: %j", box);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
var boxs = [];
|
||||||
|
imap.getBoxes(function(err,boxes) {
|
||||||
|
if (err) { return; }
|
||||||
|
for (var prop in boxes) {
|
||||||
|
if (boxes.hasOwnProperty(prop)) {
|
||||||
|
if (boxes[prop].children) {
|
||||||
|
boxs.push(prop+"/{"+Object.keys(boxes[prop].children)+'}');
|
||||||
|
}
|
||||||
|
else { boxs.push(prop); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node.error(RED._("email.errors.fetchfail", {folder:node.box+". Folders - "+boxs.join(', ')}),err);
|
||||||
|
});
|
||||||
node.status({fill:"red", shape:"ring", text:"email.status.foldererror"});
|
node.status({fill:"red", shape:"ring", text:"email.status.foldererror"});
|
||||||
node.error(RED._("email.errors.fetchfail", {folder:node.box}),err);
|
|
||||||
imap.end();
|
imap.end();
|
||||||
s = false;
|
s = false;
|
||||||
setInputRepeatTimeout();
|
setInputRepeatTimeout();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-email",
|
"name": "node-red-node-email",
|
||||||
"version": "1.7.10",
|
"version": "1.7.11",
|
||||||
"description": "Node-RED nodes to send and receive simple emails",
|
"description": "Node-RED nodes to send and receive simple emails",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user