node-imap icon indicating copy to clipboard operation
node-imap copied to clipboard

mail event does not fire

Open anshul-kai opened this issue 3 years ago • 1 comments

We've tried several implementations of getting the mail event to fire with no luck. Trying to leave the box open doesn't help nor does closing it. Can you provide a working example of the mail event firing?

anshul-kai avatar Sep 15 '22 16:09 anshul-kai

it seems that <= '* {num} RECENT' event will not fire the 'mail' event (which I think it should) caused this problem. Could you please check edit Connection.js around L 1021 to sth like this:

    else if (type === 'recent') {
      if (!this._box && RE_OPENBOX.test(this._curReq.type))
        this._createCurrentBox()
      if (this._box) {
        this._box.messages.new = info.num
        if (info.num > 0 && this.state === 'authenticated') {
          this.emit('mail', this._box.messages.new)
        }
      }
    }

will make it fire events as expected?

arily avatar Feb 22 '23 13:02 arily