diff --git a/imap-probe.js b/imap-probe.js index c500fa5..88c38ed 100644 --- a/imap-probe.js +++ b/imap-probe.js @@ -155,6 +155,8 @@ ImapProbe.prototype._scanBox = function (needle, callback) { that._fetchMessage(box.messages.total--, function (error, message) { if (error) return iteratorCallback(error); + if (message.attributes.flags.indexOf('\\Deleted') !== -1) return iteratorCallback(); // skip deleted + if (!searchMessage(message, needle)) return iteratorCallback(); // continue to next message matchedMessage = message;