class Net::IMAP::ResponseCode

Net::IMAP::ResponseCode represents response codes. Response codes can be retrieved from ResponseText#code and can be included in any “condition” response: any TaggedResponse and UntaggedResponse when the response type is a “condition” (“OK”, “NO”, “BAD”, “PREAUTH”, or “BYE”).

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. When Net::IMAP does not know how to parse response code text, data returns the unparsed string.

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.

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. 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 unknown response code data is encountered, data will return an unparsed string.

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].

Public Instance Methods

data → object or nil click to toggle source

Returns the parsed response code data, e.g: an array of capabilities strings, an array of character set strings, a list of permanent flags, an Integer, etc. The response code determines what form the response code data can take.

# File lib/net/imap/response_data.rb, line 318
    
name → string click to toggle source

Returns the response code name, such as “ALERT”, “PERMANENTFLAGS”, or “UIDVALIDITY”.

# File lib/net/imap/response_data.rb, line 311