2017-10-03 3 views
0

私はメールリスナーを初めて利用しています。添付ファイルとともにGmailの受信トレイを取得できますが、私の要件は受信トレイのみを取得することです。メールリスナーを使用して添付ファイル付き:mail-listener2を使用している添付ファイルのみで受信トレイをフェッチする方法はありますか?

var mailListener = new MailListener({ 
    username: "[email protected]", 
    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添付ファイルのみ」 またはsearchfilter:「INBOX」私は、メールボックスのような何かをしたいが、私はメールを使用しないと思います

答えて

0

「添付ファイルがあります」 -listener2は良い考えです。私の意見では、これらのサードパーティのライブラリを使用することは決して良いことではありません。他の多くの問題に対処する必要があるからです。 GoogleはGmailのAPIを使用して受信トレイにアクセスし、プッシュ通知などを受け取ることができます。https://developers.google.com/gmail/api

パスワードを公開してください。

関連する問題