【问题标题】:Receiving IDLE notifications using node-imap使用 node-imap 接收 IDLE 通知
【发布时间】: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 实现这一目标?

https://github.com/mscdex/node-imap

【问题讨论】:

标签: node.js imap node-imap


【解决方案1】:

查看文档后,似乎 IMAP 连接在收到新邮件时会发出 mail 事件:https://github.com/mscdex/node-imap#connection-events,因此监听该事件应该是通知有新邮件要接收或处理。

【讨论】:

    猜你喜欢
    • 2010-11-21
    • 1970-01-01
    • 1970-01-01
    • 2023-03-17
    • 2011-01-21
    • 2012-07-06
    • 1970-01-01
    • 2021-07-03
    相关资源
    最近更新 更多