Skip to content

Added node-imap options to deal with ofice365 bad times #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down
3 changes: 3 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down