Here is my code but its not working for sent message folder. I have tried using node-imap and node-inbox and node-maillistner2 module but none of them were able to retrieve the sent message box. I am using ymail account and imap server.
var inbox = require("inbox");
console.log(mailLogin);
var client = inbox.createConnection(false, mailLogin.imapserver, {
secureConnection: mailLogin.isTlsEnabled,
auth: {
user: mailLogin.email,
pass: mailLogin.password
}
});
client.connect();
client.listMailboxes({all:true}, function (error, info) {
console.log(info)
})
client.on("connect", function () {
client.openMailbox("INBOX/SENT", function (error, info) {
if (error) throw error;
client.listMessages(-10, function (err, messages) {
messages.forEach(function (message) {
console.log(message.UID + ": " + message.title);
});
});
});
});