【问题标题】:How to fetch Inbox only with attachments using mail-listener2?如何使用 mail-listener2 仅获取带有附件的收件箱?
【发布时间】:2018-03-14 15:51:03
【问题描述】:

我是邮件侦听器的新手。我能够获取 gmail 收件箱以及附件,但我的要求是仅获取收件箱。使用邮件侦听器的附件:

var mailListener = new MailListener({
    username: "xxxx@gmail.com",
    password: "xxx",
    host: "imap.gmail.com",
    port: 993, // imap port
    tls: true,
    //ssl:true,
    connTimeout: 10000, // Default by node-imap
    authTimeout: 5000, // Default by node-imap,
    debug: console.log, // Or your custom function with only one   incoming argument. Default: null
    tlsOptions: { rejectUnauthorized: false },
    mailbox: "INBOX", // mailbox to monitor
    //searchFilter: ["UNSEEN", "FLAGGED"], // the search filter being used after an IDLE notification has been retrieved
    markSeen: true, // all fetched email willbe marked as seen and not fetched next time
    fetchUnreadOnStart: true, // use it only if you want to get all unread email on lib start. Default is `false`,
    mailParserOptions: {streamAttachments: true}, // options to be passed to mailParser lib.
    attachments: true, // download attachments as they are encountered to the project directory
    attachmentOptions: { directory: "attachments/" } // specify a   download directory for attachments
});

取而代之的是邮箱:“INBOX”,我想要类似邮箱:“INBOX ONLY ATTACHMENTS”的东西 或搜索过滤器:“有附件”

【问题讨论】:

    标签: node.js email gmail-imap


    【解决方案1】:

    我不认为使用 mail-listener2 是一个好主意。在我看来,使用这些第三方库从来都不是一件好事,因为您将不得不处理许多其他问题。 Google 提供了 Gmail API,您可以使用它访问收件箱、获取推送通知等。在此处阅读 https://developers.google.com/gmail/api

    顺便说一句,你已经公开了你的密码。

    【讨论】:

      猜你喜欢
      • 2012-07-19
      • 1970-01-01
      • 2018-08-17
      • 2012-10-17
      • 2016-09-28
      • 1970-01-01
      • 2011-05-30
      • 2018-07-17
      • 2017-09-11
      相关资源
      最近更新 更多