2017-10-03 9 views
0

나는 mail-listener를 처음 사용합니다. 첨부 파일과 함께 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 좋은 생각입니다. 제 생각에는 이러한 제 3 자 라이브러리를 사용하는 것은 결코 좋은 일이 아닙니다. 다른 많은 문제를 다루어야하기 때문입니다. Google은받은 편지함에 액세스하고 푸시 알림 등을받을 수있는 Gmail API를 제공합니다. 여기에 대해 읽어보십시오. https://developers.google.com/gmail/api

그리고 암호를 공개로 설정해야합니다.