diff --git a/index.js b/index.js index 56a12cb..1173856 100644 --- a/index.js +++ b/index.js @@ -28,6 +28,9 @@ function MailListener(options) { xoauth2: options.xoauth2, user: options.username, password: options.password, + authTimeout: options.authTimeout, + connTimeout: options.connTimeout, + debug: options.debug, host: options.host, port: options.port, tls: options.tls, diff --git a/readme.md b/readme.md index 95a586d..2def1ea 100644 --- a/readme.md +++ b/readme.md @@ -27,6 +27,9 @@ var mailListener = new MailListener({ port: 993, // imap port tls: true, tlsOptions: { rejectUnauthorized: false }, + authTimeout:50000, // how long to wait before timing out while authenticating (useful for imap providers that take awhile, such as office 365) + connTimeout:50000, // how long to wait before timing out while connection + debug:console.log, // function to call imap connection debug messages on (defaults to nothing) 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 @@ -71,9 +74,9 @@ mailListener.imap.move(:msguids, :mailboxes, function(){}) That's easy! ## Attachments -Attachments can be streamed or buffered. This feature is based on how [mailparser](https://github.com/andris9/mailparser#attachments) handles attachments. +Attachments can be streamed or buffered. This feature is based on how [mailparser](https://github.com/andris9/mailparser#attachments) handles attachments. Setting `attachments: true` will download attachments as buffer objects by default to the project directory. -A specific download directory may be specified by setting `attachmentOptions: { directory: "attachments/"}`. +A specific download directory may be specified by setting `attachmentOptions: { directory: "attachments/"}`. Attachments may also be streamed using `attachmentOptions: { stream: "true"}`. The `"attachment"` event will be fired every time an attachment is encountered. Refer to the [mailparser docs](https://github.com/andris9/mailparser#attachment-streaming) for specifics on how to stream attachments. diff --git a/test.js b/test.js index c22f3b5..86ad6f6 100644 --- a/test.js +++ b/test.js @@ -8,6 +8,9 @@ var mailListener = new MailListener({ tls: true, tlsOptions: { rejectUnauthorized: false }, mailbox: "INBOX", + authTimeout: 50000, + connTimeout: 50000, + debug:console.log, markSeen: true, fetchUnreadOnStart: true, attachments: true,