【问题标题】:fetch sent emails from gmail imap using nodejs使用nodejs从gmail imap获取发送的电子邮件
【发布时间】:2020-08-18 06:30:25
【问题描述】:

我正在尝试使用 nodemailer 通过 Imap 从 gmail 服务器获取 SENT 电子邮件。

以下解决方案不起作用,结果是收件箱未发送

var imap = new Imap({
        user: request.body.email,
        password: request.body.password,
        host: '{imap.gmail.com:993/imap/ssl}INBOX.Sent',
        port: 993,
        tlsOptions: { rejectUnauthorized: false },
        tls: true
    });

【问题讨论】:

  • Gmail 的邮箱名称并非您想象的那样。发出LIST 请求并找到正确的名称。

标签: node.js imap nodemailer gmail-imap


【解决方案1】:

看看下面的链接:

  1. Special-Use Extension of the LIST command
...
* LIST (\HasNoChildren \Sent) "/" "[Gmail]/Sent Mail"
...

如您所见,[Gmail]/Sent Mail 就是您所需要的。

记住,如果您的界面语言与英文不同,标签名称将被更改。

  1. 这里有一个关于如何Access to Gmail labels: X-GM-LABELS的例子
...
* 1 FETCH (X-GM-LABELS (\Inbox \Sent Important "Muy Importante"))
...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-09
    • 2018-11-02
    • 1970-01-01
    • 1970-01-01
    • 2021-07-06
    • 2013-04-12
    • 1970-01-01
    • 2019-07-12
    相关资源
    最近更新 更多