【发布时间】:2019-10-07 23:31:10
【问题描述】:
我已经成功连接到node-imap的邮箱:
const imap = new Imap({
user: 'user@yandex.com',
password: 'pwd',
host: 'imap.yandex.com',
port: 993,
tls: true
});
imap.once('ready', () => {
console.log('Opening inbox');
imap.openBox('INBOX', true, (error, mailbox) => {
if (error) throw error;
// ???
});
});
我现在如何在新电子邮件到达时收到通知?我已经阅读了有关 IMAP 的信息,我应该使用 IDLE 命令。但是我如何使用node-imap 实现这一目标?
【问题讨论】:
-
看起来像
mail事件:github.com/mscdex/node-imap#connection-events -
@ChrisWhite - 是的!如果您有任何想将其作为答案的愿望,我很乐意给它打上绿色的勾。