Open martinericksonn opened 1 year ago
Supposed after executing getBoxes() the connection will end thus log connection ended but instead is stuck after logging all the key
getBoxes()
connection ended
key
const connection = new Imap(credential); let folders = []; connection.once("ready", () => { connection.getBoxes(function more(err, boxes, path) { if (err) throw err; for (var key in boxes) { if (boxes[key].children) more( undefined, boxes[key].children, path + key + boxes[key].delimiter ); else { console.log(key); folders.push(`INBOX.${key}`); } } }); }); connection.once("error", function (err) { console.log(err); throw err; }); connection.once("end", function () { console.log("Connection ended "); resolve(folders); }); connection.connect();
Supposed after executing
getBoxes()
the connection will end thus logconnection ended
but instead is stuck after logging all thekey