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

Mail event not triggered, and debug logs "IDLE NO Need to SELECT first!" endlessly

Open RepSklvska opened this issue 11 months ago • 0 comments

Similar to this one, not being triggered when receiving new mails: https://github.com/mscdex/node-imap/issues/889

import Imap, { } from 'imap'

const imapClient = new Imap({
	user: process.env.EMAIL_USERNAME!,
	password: process.env.EMAIL_PASSWORD!,
	host: process.env.IMAP_SERVER!,
	port: Number(process.env.IMAP_PORT),
	tls: true,
	debug: console.log,
})

imapClient.on('mail', (num: number) => {
	console.log('received mail', num)
})

My debug output is different than that one, it's like this and logging endlessly:

[connection] Connected to host
<= '* OK [CAPABILITY IMAP4 IMAP4rev1 ID AUTH=PLAIN AUTH=LOGIN AUTH=XOAUTH2 NAMESPACE] QQMail XMIMAP4Server ready'
=> 'A0 CAPABILITY'
<= '* CAPABILITY IMAP4 IMAP4rev1 XLIST MOVE IDLE XAPPLEPUSHSERVICE SASL-IR AUTH=PLAIN AUTH=LOGIN AUTH=XOAUTH2 NAMESPACE CHILDREN ID UIDPLUS'
<= 'A0 OK CAPABILITY Completed'
=> 'A1 LOGIN "[email protected]" "xxxxxxx"'
<= 'A1 OK Success login ok'
=> 'A2 CAPABILITY'
<= '* CAPABILITY IMAP4 IMAP4rev1 XLIST MOVE IDLE XAPPLEPUSHSERVICE NAMESPACE CHILDREN ID UIDPLUS COMPRESS=DEFLATE'
<= 'A2 OK CAPABILITY Completed'
=> 'A3 NAMESPACE'
<= '* NAMESPACE (("" "/")) NIL NIL'
<= 'A3 OK NAMESPACE Success'
=> 'A4 LIST "" ""'
<= '* LIST (\\NoSelect) "/" "/"'
<= 'A4 OK LIST completed'
=> 'IDLE IDLE'
<= 'IDLE NO Need to SELECT first!'
=> 'IDLE IDLE'
<= 'IDLE NO Need to SELECT first!'
=> 'IDLE IDLE'
<= 'IDLE NO Need to SELECT first!'
=> 'IDLE IDLE'
<= 'IDLE NO Need to SELECT first!'
=> 'IDLE IDLE'
<= 'IDLE NO Need to SELECT first!'
=> 'IDLE IDLE'
<= 'IDLE NO Need to SELECT first!'
=> 'IDLE IDLE'
<= 'IDLE NO Need to SELECT first!'

Can it be a server side issue?

RepSklvska avatar Jan 31 '25 09:01 RepSklvska