Skip to main content

Protocol commands

This page covers the low-level protocol commands: capability(), noop() and enable().

capability()

Re-issues the CAPABILITY command (RFC 9051 §6.1.1), updates imap.capabilities and returns it. Useful after a STARTTLS upgrade (the library already does this automatically during connect()).

const caps = await imap.capability()
// caps === imap.capabilities, e.g. ["IMAP4rev1", "UIDPLUS", "MOVE"]

noop()

Sends NOOP — commonly used to keep the connection alive and to trigger any pending unsolicited updates. Returns the untagged responses received.

const updates = await imap.noop()
// e.g. [ { line: "* 5 EXISTS", literal: null } ]

enable()

Enables IMAP extensions via the ENABLE command (RFC 9051 §6.3.1). Only valid in the authenticated state, before selecting a mailbox. Returns the capabilities the server confirmed.

const enabled = await imap.enable("CONDSTORE")
// e.g. ["CONDSTORE"]
info

connect() already issues ENABLE IMAP4rev2 automatically when a server advertises both IMAP4rev1 and IMAP4rev2 (RFC 9051 Appendix A) — you normally don't need to call enable() yourself. It is exposed for enabling extensions like CONDSTORE (RFC 7162).