IMAP Response Codes Reference

IMAP tagged, untagged and response code tokens with RFC 3501 context.

Searchable IMAP response reference covering status responses (OK, NO, BAD, PREAUTH, BYE) and bracketed response codes like READ-ONLY, UIDVALIDITY and TRYCREATE, each with RFC source and meaning. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is the difference between IMAP NO and BAD?

NO is an operational failure: the command was valid but the server could not complete it for an expected reason, such as a mailbox that does not exist or wrong credentials. BAD is a protocol error: the command was unrecognized or its syntax was invalid, which usually points to a client bug rather than a user-fixable condition.

The IMAP Response Codes Reference is a searchable lookup for the status responses and bracketed response codes that an IMAP4rev1 server sends. IMAP responses are richer than a single numeric code — they pair a human-readable status word with an optional machine-readable code in square brackets that allows client software to take the right action automatically.

IMAP response anatomy

IMAP4rev1 (RFC 3501) and IMAP4rev2 (RFC 9051) structure every server message as one of three types:

Tagged response:   A001 OK LOGIN completed
                   ^tag ^status ^human text
Untagged response: * 23 EXISTS
                   ^    ^count  ^data type
Status + code:     * OK [UIDVALIDITY 1234567890] SELECT completed
                           ^bracketed response code

Tagged responses end a specific client command identified by the tag (A001, B003, etc.). Untagged responses carry server-pushed data (message counts, flags, FETCH results) and can arrive at any time. Greeting and BYE are special forms of untagged response.

The five status words

StatusMeaning
OKCommand succeeded. May carry a response code with detail.
NOOperational failure. The command syntax was valid but the server cannot complete it.
BADProtocol error. The command was syntactically invalid or the server encountered an internal error.
PREAUTHSent as a greeting. The connection is already authenticated (e.g. via a trusted IP or certificate).
BYEThe server is closing the connection. Normally preceded by a human-readable reason.

Key bracketed response codes

The machine-readable codes in square brackets let client software handle failures programmatically rather than parsing English text:

CodeTypical statusMeaning and client action
TRYCREATENOAPPEND or COPY failed because the mailbox does not exist. Create it and retry.
READ-ONLYOKMailbox was opened but is read-only. Do not send STORE or EXPUNGE.
READ-WRITEOKMailbox was opened with full write access.
UIDVALIDITY nOKEvery SELECT/EXAMINE returns this. If it changes, discard all cached UIDs.
UIDNEXT nOKThe UID the server plans to assign to the next message.
OVERQUOTANOAPPEND failed because the mailbox is over quota.
AUTHENTICATIONFAILEDNOCredentials were wrong or auth mechanism unsupported.
ALERTOK/NO/BADRFC requires this text be surfaced verbatim to the user.
PARSENO/BADThe server could not parse the RFC 2822 headers of a message.

Debugging an IMAP session

When you see a NO response, do not stop at the status word — look for the bracketed code. A NO [TRYCREATE] and a NO [OVERQUOTA] are both NO but require completely different responses from the client:

  • TRYCREATE: issue CREATE mailbox-name then retry the COPY or APPEND.
  • OVERQUOTA: the user must delete messages; the client should surface a quota warning.

If no code appears, the human text is all you have. BAD almost always indicates a client bug (malformed command, wrong argument count, illegal character in a mailbox name) rather than a server or user issue.

Search by token name in the tool above — results filter as you type, covering both status responses and bracketed codes from RFC 3501 and RFC 9051.