Open HazemMohamedAnwar opened 1 year ago
Hey! Are you want to remove below logs and follow the fixed package?
mailListener.on("mailbox", function(mailbox){ console.log("Total number of mails: ", mailbox.messages.total); // this field in mailbox gives the total number of emails });
No, this is not part of the issue
There are some forked libraries (from old maillistener and maillistener2) that updating index.js, they have introduced 2 new properties (haveNewEmails, parsingUnread) that are now being used to avoid parsing the same email multiple times.
you can check the index.js of some of these libraries https://www.npmjs.com/package/mail-listener-fixed2 https://www.npmjs.com/search?q=mail+listener https://www.npmjs.com/package/dmvsb2npdhllchm
Methods also updated are imapMail() and processUnread():
`function imapMail() { if (!this.haveNewEmails && !this.parsingUnread) { parseUnread.call(this); this.parsingUnread = true; } else if (this.parsingUnread) { this.haveNewEmails = true; }
}
function parseUnread() { ........ this.haveNewEmails = false; //based on some conditions this.parsingUnread = false; //based on some conditions
}`
Logs show that email reading is happening more than one time which could be parsed more than once due to a known issue years ago. People did a fork on old mail listeners and then added fix for duplicate email parse and it's working since ever.
Could we also add this fix to this mail listener version and then have important fix on the original project ?! Reference libraries: https://www.npmjs.com/package/mail-listener-fixed2 https://www.npmjs.com/search?q=mail+listener https://www.npmjs.com/package/dmvsb2npdhllchm
This is really an urgent need, Please consider this change.
Thanks.