class Net::IMAP::ResponseCode

ResponseCode represents an IMAP response code, which can be retrieved from ResponseText#code for “status responses”:

Note that these “status responses” are confusingly not the same as the STATUS UntaggedResponse (see IMAP#status and StatusData).

Some response codes come with additional data which will be parsed by Net::IMAP. Others return nil for data, but are used as a machine-readable annotation for the human-readable ResponseText#text in the same response.

Untagged response code data is pushed directly onto Net::IMAP#responses, keyed by name, unless it is removed by the command that generated it. Use Net::IMAP#add_response_handler to view tagged response codes for command methods that do not return their TaggedResponse.

Standard response codes

IMAP extensions may define new codes and the data that comes with them. The IANA IMAP Response Codes registry has links to specifications for all standard response codes.

IMAP4rev1 response codes

See [IMAP4rev1] §7.1, “Server Responses - Status Responses” for full definitions of the basic set of IMAP4rev1 response codes:

BINARY extension

See [RFC3516].

UIDPLUS extension

See [RFC4315 §3].

SEARCHRES extension

See [RFC5182].

RFC5530 response codes

See [RFC5530], “IMAP Response Codes” for the definition of the following response codes, which are all machine-readable annotations for the human-readable ResponseText#text, and have nil data of their own:

QRESYNC extension

See [RFC7162].

IMAP4rev2 response codes

See [RFC9051] §7.1, “Server Responses - Status Responses” for full descriptions of IMAP4rev2 response codes. IMAP4rev2 includes all of the response codes listed above (except “UNSEEN”) and adds the following:

CONDSTORE extension

See [RFC7162].

OBJECTID extension

See [RFC8474].

Extension compatibility

Response codes are backwards compatible: Servers are allowed to send new response codes even if the client has not enabled the extension that defines them. When Net::IMAP does not know how to parse response code text, data returns the unparsed string.