unstale

npm / imapflow

imapflow

What changed in imapflow 1 to 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-20.

15 breaking13 security26 new APIs and options3 behavior and defaults115 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

imapflow 2104 changes

Breaking changes 13

  • fetch() rejects when no mailbox is selected instead of returning nothing.

    2.6.0release notes

  • A tagged BYE no longer passes as success.

    2.5.1release notes

  • ImapSocket is now an alias of ImapTransportSocket rather than net.Socket; TypeScript code using net.Socket-only members needs a cast.

    2.5.0release notes

  • Commands now fail on a NO or BAD status line without a tag.

    2.4.3release notes

  • Drops flags and keywords that are not atoms rather than sending them quoted.

    2.2.8release notes

  • Unknown search keys are refused instead of being accepted.

    2.2.7release notes

  • A NUL in a non-ASCII search value is rejected instead of being sent as a literal.

    2.2.3release notes

  • Search refuses empty operands.

    2.1.1release notes

  • Throttle, truncation and listener failures are surfaced instead of hidden, so callers can detect them.

    2.0.8release notes

  • The declarations no longer expose ImapFlow's internal members.

    2.0.0release notes

  • The export map provides a supported path for accessing library modules now that the lib/ directory is no longer published.

    2.0.0release notes

  • The lib/ directory is no longer published; use the package root or the imapflow/lib/* export map instead.

    2.0.0release notes

  • Node.js 20 or newer is now required to use imapflow.

    2.0.0release notes

Security 2

  • Limits what a hostile server can make the client buffer or wait for.

    2.5.1release notes

  • Response parsing and command compilation were hardened after issues were found by fuzzing.

    2.2.6release notes

New APIs and options 21

  • The strict option for search() rejects an answer it cannot read in full.

    2.12.0release notes

  • Sets a known session expiry as a Date or milliseconds since the epoch; the client closes the connection before the server ends the session so the application can reconnect with a fresh token.

    2.11.0release notes

  • Sets the lead time before expiry for proactively closing a session; it defaults to 5 minutes.

    2.11.0release notes

  • The download() option decodeText: false returns transfer-decoded bytes without format=flowed unwrapping or charset conversion, for saving text parts as original files.

    2.10.0release notes

  • A close can be identified as one the application asked for rather than one made by the server.

    2.9.0release notes

  • idle({ whenFree: true }) waits for the connection to be free before starting IDLE.

    2.8.0release notes

  • Exposes idlingAtClose so a consumer can tell when a session dropped in IDLE.

    2.7.0release notes

  • Exposes connectedAt on the client.

    2.6.0release notes

  • Exposes context on the client.

    2.6.0release notes

  • Exposes lastClientWrite on the client.

    2.6.0release notes

  • Exposes mailboxList on the client.

    2.6.0release notes

  • Added createSocketsTransport() for celld.

    2.5.0release notes

  • Added createStreamsTransport() for socket APIs built on web streams.

    2.5.0release notes

  • A transport option was added for celld.

    2.5.0release notes

  • Unexpected parser exceptions are re-raised as coded ParserErrorInternal errors.

    2.4.0release notes

  • An alert event is emitted for ALERT response codes, allowing applications to handle these server alerts.

    2.3.0release notes

  • The client can choose the hash used behind the fallback message id.

    2.2.0release notes

  • Exports ImapFlowErrorCode with the error codes set by the library.

    2.1.0release notes

  • Supports await using through Symbol.asyncDispose.

    2.1.0release notes

  • Bun and Cloudflare Workers are now supported runtimes.

    2.0.0release notes

  • The package now provides ES module and CommonJS builds.

    2.0.0release notes

Behavior and default changes 2

  • Auto-IDLE never waits longer than maxIdleTime.

    2.9.0release notes

  • A warning is issued when STARTTLS falls back to cleartext, making the fallback visible to developers.

    2.2.7release notes

Fixes and other changes 66

  • CONDSTORE is treated as enabled when ENABLE gets OK without an ENABLED line.

    2.12.0release notes

  • QRESYNC is treated as enabled when ENABLE gets OK without an ENABLED line.

    2.12.0release notes

  • Memory used by a SEARCH answer or a BODYSTRUCTURE is bounded.

    2.12.0release notes

  • logout() marks the close as the application's before starting the LOGOUT exchange.

    2.9.0release notes

  • The error event is emitted at most once per connection.

    2.6.0release notes

  • idle() waits for a free connection before starting IDLE.

    2.6.0release notes

  • idle() starts IDLE right away when called inside a mailbox lock.

    2.6.0release notes

  • A mailbox lock is rejected when the processLocks pass handling it throws.

    2.6.0release notes

  • Reports UIDVALIDITY and HIGHESTMODSEQ changes detected by the polling fallback.

    2.6.0release notes

  • A failed SELECT mailbox is treated as existing only when there is an exact LIST match.

    2.6.0release notes

  • No longer reports APPENDUID UIDVALIDITY next to a looked up UID.

    2.5.9release notes

  • Bounds the parse cost of responses with many literals or tokens.

    2.5.9release notes

  • Uses the bundled types for libmime, libqp, libbase64, and encoding-japanese.

    2.5.8release notes

  • SEARCH answers are read into a number array, and search rejects when the command did not complete.

    2.5.6release notes

  • The ID command is sent after STARTTLS instead of before it.

    2.4.3release notes

  • Download decoding handles padded base64 parts in linear memory.

    2.4.1release notes

  • Append literals are kept in sync with their data.

    2.4.0release notes

  • Downloads fail cleanly.

    2.4.0release notes

  • The first chunk of a download is requested again when the answer comes back empty.

    2.3.0release notes

  • A throttled login is no longer treated as a rejected credential.

    2.3.0release notes

  • An empty response for a download chunk causes the chunk to be requested again instead of failing the download.

    2.2.11release notes

  • Reads NAMESPACE prefixes, QUOTAROOT names, and ID values when the server sends them as literals.

    2.2.11release notes

  • fetchOne() takes the requested message when a FETCH answer also carries unsolicited rows.

    2.2.10release notes

  • Socket errors after a failed STARTTLS upgrade are logged instead of thrown on Bun.

    2.2.10release notes

  • Declares DownloadOptions.binary so TypeScript users can use the option with its type recognized.

    2.2.9release notes

  • Declares the QRESYNC mailboxOpen options in the type definitions.

    2.2.9release notes

  • Refetches body sections that Apache James drops.

    2.2.8release notes

  • Enables CONDSTORE with QRESYNC.

    2.2.8release notes

  • Checks that FETCH answers belong to the download.

    2.2.8release notes

  • Expands FETCH ALL, FAST, and FULL macros instead of sending them in a list.

    2.2.8release notes

  • Encodes and decodes non-ASCII Gmail labels as modified UTF-7, like mailbox names.

    2.2.8release notes

  • Decrements mailbox.exists when the server sends an untagged VANISHED response, keeping the mailbox count consistent.

    2.2.8release notes

  • Sends the OAuth token after the continuation request when SASL-IR is not advertised.

    2.2.8release notes

  • Does not send sequence sets when the mailbox is empty.

    2.2.8release notes

  • Sends the UNCHANGEDSINCE modifier before the flags.

    2.2.8release notes

  • Leaves servername out of tls.connect() for IP literal hosts, which Bun rejects.

    2.2.8release notes

  • downloadMany now enforces maxBytes, preventing downloads from exceeding the configured byte limit.

    2.2.7release notes

  • A lost login is reported only once.

    2.2.7release notes

  • The transport is closed when a connection attempt fails.

    2.2.7release notes

  • Digit-led atoms such as "2024:Q1" are read instead of causing the response line to be dropped.

    2.2.6release notes

  • Non-ASCII search values are sent as literals, addressing issue #417.

    2.2.3release notes

  • Append flags are kept when the destination is not an open read-write mailbox.

    2.2.2release notes

  • A flag update that reduces to nothing no longer clears every flag.

    2.2.2release notes

  • IMAP4rev2 is no longer enabled on Strato RZimapd, avoiding the issue with that server.

    2.2.1release notes

  • Closing settles every pending connect operation.

    2.1.1release notes

  • NIL envelope rows are kept.

    2.1.1release notes

  • Top-level special-use folders are preferred.

    2.1.1release notes

  • Reads the last extension field of a BODYSTRUCTURE part.

    2.1.0release notes

  • Rejects connect() immediately when the server sends a BYE greeting.

    2.1.0release notes

  • Processes a chunk that arrives while the input loop is winding down.

    2.1.0release notes

  • Parses a chunk containing many literals in a loop instead of recursing.

    2.1.0release notes

  • Preserves a bracketed IPv6 host in a REFERRAL URL.

    2.1.0release notes

  • When the best special-use candidate is taken, its next candidate is given a special-use type.

    2.1.0release notes

  • QRESYNC accepts uidValidity as either a number or a string.

    2.1.0release notes

  • Keeps auto-IDLE disabled on a socket handed over by unbind().

    2.1.0release notes

  • The quota response type now describes the value returned by getQuota().

    2.0.8release notes

  • The source is no longer expunged when the fallback COPY fails, preventing message loss.

    2.0.8release notes

  • Body sections sent by the server as quoted strings are now kept as quoted strings.

    2.0.7release notes

  • The parser now splits flags when a server writes them without the separating space.

    2.0.6release notes

  • The chunked download loop is bounded by the reported message size.

    2.0.3release notes

  • Chunked downloads stop when the server ignores the partial spec.

    2.0.3release notes

  • Skip LSUB after a server rejects ENABLE over the IMAP4rev2 it advertises.

    2.0.2release notes

  • Imapflow stops acting on an IMAP4rev2 advertisement after the server rejects ENABLE over it.

    2.0.1release notes

  • AuthenticationFailure.response is now typed as a string, matching its actual value.

    2.0.0release notes

  • Auto-IDLE is re-armed after an IDLE or poll session ends on its own.

    2.0.0release notes

  • Events are typed without relying on the generic EventEmitter from @types/node.

    2.0.0release notes

imapflow 168 changes

Breaking changes 2

  • Non-secure connections now default to IMAP port 143 instead of POP3 port 110.

    1.4.8release notes

  • close() now rejects synchronously instead of using setImmediate.

    1.2.15release notes

Security 11

  • Credential frames are masked in the raw log while error detail is preserved.

    1.7.1release notes

  • Parsing of untrusted server response values was hardened.

    1.6.6release notes

  • Blocks IMAP command injection.

    1.6.4release notes

  • Hardens rev2 protocol handling.

    1.6.4release notes

  • Response parsing, tag correlation, IDLE polling, and proxy connection setup are hardened.

    1.6.0release notes

  • The FLAGS guard was hardened; the notes do not specify the affected behavior.

    1.3.7release notes

  • Connection error paths were hardened.

    1.3.6release notes

  • Literal bounds handling was hardened.

    1.3.6release notes

  • The STARTTLS upgrade path was hardened.

    1.3.6release notes

  • Hardens the parser.

    1.3.5release notes

  • Hardened mailbox-lock and error-propagation paths.

    1.3.2release notes

New APIs and options 5

  • The auto-IDLE delay is configurable through autoIdleDelay.

    1.7.0release notes

  • Adds rev2 BINARY fetch support.

    1.5.0release notes

  • Adds support for STATUS SIZE/DELETED.

    1.5.0release notes

  • The search compiler supports a Gmail label search term.

    1.4.0release notes

  • Adds ESEARCH (RFC 4731) and PARTIAL (RFC 9394) support.

    1.3.0release notes

Behavior and default changes 1

  • Special-use folder names are expanded from client localization catalogs, allowing localized names to be recognized.

    1.6.0release notes

Fixes and other changes 49

  • Keeps the pipeline error forwarder across a backpressure wait, preventing errors from being lost.

    1.7.8release notes

  • A re-stamped rejection no longer carries the previous site's markers.

    1.7.6release notes

  • An IDLE-break waiter now has its own rejection site.

    1.7.5release notes

  • Search dates are normalized so invalid values cannot throw or emit NaN.

    1.7.4release notes

  • Connection errors are stamped, and the rejection guard is structural, making connection-error handling more consistent.

    1.7.3release notes

  • The IDLE preCheck waiter is guarded, and connection errors name the rejection site.

    1.7.3release notes

  • Envelope parsing no longer invents an address when the host field is NIL.

    1.7.2release notes

  • The type now accepts string[] paths.

    1.7.2release notes

  • Auto-IDLE is kept off a busy connection.

    1.7.0release notes

  • The socket watchdog is aligned with the auto-IDLE busy guard.

    1.7.0release notes

  • Folders are assumed to be subscribed when the server reports no subscription state.

    1.6.3release notes

  • IMAP4rev2 sessions no longer fall back to LSUB.

    1.6.2release notes

  • Authentication results are now kept on a verifyOnly connection.

    1.6.1release notes

  • Missing localized special-use folder names are added, and names are normalized to NFC.

    1.6.0release notes

  • Decorated folder names are matched, and special-use names are normalized to NFKC.

    1.6.0release notes

  • The types now declare specialUseHints.archive.

    1.6.0release notes

  • The types now declare specialUseSource.

    1.6.0release notes

  • Fixes protocol bugs found in an RFC 9051 review.

    1.5.0release notes

  • The list operation requests subscription state inline and supports IMAP4rev2.

    1.4.9release notes

  • Folder handling now passes the StatusObject value instead of its boolean primitive.

    1.4.9release notes

  • The OAUTHBEARER payload now describes the real connection.

    1.4.8release notes

  • Mailboxes marked \NonExistent in LIST responses are treated as \Noselect.

    1.4.7release notes

  • Corrects flag removal behavior.

    1.3.5release notes

  • Prevents host process crashes caused by socket errors after unbind() when COMPRESS=DEFLATE is active.

    1.3.5release notes

  • Corrects literal parsing.

    1.3.5release notes

  • Corrects path normalization.

    1.3.5release notes

  • Handles THREADID NIL in FETCH responses.

    1.3.4release notes

  • Handles a NIL delimiter in NAMESPACE responses, as specified by RFC 2342.

    1.3.3release notes

  • Handles the plain Array form for PARTIAL in the ESEARCH parser.

    1.3.0release notes

  • Corrects the return type of ESEARCH search().

    1.3.0release notes

  • Compound OR/NOT search conditions are parenthesized according to RFC 3501.

    1.2.16release notes

  • Corrects handling of red at index 0, which was treated as falsy.

    1.2.14release notes

  • Matches euc-jp in decoder selection.

    1.2.14release notes

  • Uses nullish coalescing when resolving flag colors.

    1.2.14release notes

  • Uses nullish coalescing in charset resolution.

    1.2.14release notes

  • Handles BigInt(0) in uidValidity checks.

    1.2.14release notes

  • Prevents unhandled promise rejections when close() encounters race conditions.

    1.2.13release notes

  • Prevents an unhandled NoConnection rejection during IDLE recovery.

    1.2.12release notes

  • The fetch() generator releases backpressure when iteration ends early through break or throw.

    1.2.11release notes

  • Null guards in compress() prevent a crash during TLS teardown.

    1.2.10release notes

  • Transform streams now implement _destroy() methods for proper cleanup.

    1.2.7release notes

  • Restores the isClosed check and error logging in initialPREAUTH.

    1.2.6release notes

  • Prevents memory leaks in socket and event handling.

    1.2.6release notes

  • Adds the missing text search property to the TypeScript definitions so developers can use it with type support.

    1.2.5release notes

  • Improves resource cleanup when a connection closes.

    1.2.4release notes

  • Adds logging for download errors that were silently swallowed, making them visible to developers.

    1.2.3release notes

  • Pending mailbox locks are rejected when the connection closes.

    1.2.2release notes

  • Promise rejections are deferred when a connection closes to prevent unhandled rejections.

    1.2.1release notes

  • Prevents a race condition when receiving the initial IMAP greeting.

    1.1.1release notes