Class: Net::IMAP::ResponseCode
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Class Chain: 
          self,
          Struct
         | |
| Instance Chain: 
          self,
          Struct
         | |
| Inherits: | Struct 
 | 
| Defined in: | lib/net/imap/response_data.rb | 
Overview
ResponseCode represents an IMAP response code, which can be retrieved from ResponseText#code for “status responses”:
- 
every TaggedResponse, name is always “OK”, “NO”, or “BAD”.
- 
any UntaggedResponsewhen name is “OK”, “NO”, “BAD”, “PREAUTH”, or “BYE”.
Note that these “status responses” are confusingly not the same as the STATUS UntaggedResponse (see #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 #responses, keyed by #name, unless it is removed by the command that generated it. Use #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:
- 
ALERT, the ResponseText#text contains a special alert that MUST be brought to the user’s attention.
- 
BADCHARSET, #data will be an array of charset strings, ornil.
- 
CAPABILITY, #data will be an array of capability strings.
- 
PARSE, the ResponseText#text presents an error parsing a message’s [RFC5322] or [MIME-IMB] headers.
- 
PERMANENTFLAGS, followed by an array of flags. System flags will be symbols, and keyword flags will be strings. See Net::IMAP@System+flags
- 
READ-ONLY, the mailbox was selected read-only, or changed to read-only
- 
READ-WRITE, the mailbox was selected read-write, or changed to read-write
- 
TRYCREATE, when #append or #copy fail because the target mailbox doesn’t exist.
- 
UIDNEXT, #data is an Integer, the next UID value of the mailbox. See [IMAP4rev1], §2.3.1.1, “Unique Identifier (UID) Message Attribute.
- 
UIDVALIDITY, #data is an Integer, the UID validity value of the mailbox. See [IMAP4rev1], §2.3.1.1, “Unique Identifier (UID) Message Attribute.
- 
UNSEEN, #data is an Integer, the number of messages which do not have the\Seenflag set. DEPRECATED by IMAP4rev2.
BINARY extension
See [RFC3516].
- 
UNKNOWN-CTE, with a taggedNOresponse, when the server does not known how to decode a CTE (content-transfer-encoding). #data isnil. See IMAP#fetch.
UIDPLUS extension
See [RFC4315 §3].
- 
APPENDUID, #data isUIDPlusData. See #append.
- 
COPYUID, #data isUIDPlusData. See #copy.
SEARCHRES extension
See [RFC5182].
- 
NOTSAVED, with a taggedNOresponse, when the search result variable is not saved. #data isnil.
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:
- 
UNAVAILABLE
- 
AUTHENTICATIONFAILED
- 
AUTHORIZATIONFAILED
- 
EXPIRED
- 
PRIVACYREQUIRED
- 
CONTACTADMIN
- 
NOPERM
- 
INUSE
- 
EXPUNGEISSUED
- 
CORRUPTION
- 
SERVERBUG
- 
CLIENTBUG
- 
CANNOT
- 
LIMIT
- 
OVERQUOTA
- 
ALREADYEXISTS
QRESYNC extension
See [RFC7162].
- 
CLOSED, returned when the currently selected mailbox is closed implicitly by selecting or examining another mailbox. #data isnil.
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:
- 
HASCHILDREN, with a tagged NOresponse, when a mailbox delete failed because the server doesn’t allow deletion of mailboxes with children. #data isnil.
CONDSTORE extension
See [RFC7162].
- 
NOMODSEQ, when selecting a mailbox that does not support mod-sequences. #data isnil. See IMAP#select.
- 
HIGHESTMODSEQ, #data is an Integer, the highest mod-sequence value of all messages in the mailbox. See IMAP#select.
- 
MODIFIED, #data is aSequenceSet, the messages that have been modified since theUNCHANGEDSINCEmod-sequence given toSTOREorUID STORE.
OBJECTID extension
See [RFC8474].
- 
MAILBOXID, #data is a string
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.
Instance Attribute Summary
- 
    
      #data  
    
    rw
    ResponseCoderepresents an IMAP response code, which can be retrieved from ResponseText#code for “status responses”: * everyTaggedResponse, name is always.
- 
    
      #name  
    
    rw
    ResponseCoderepresents an IMAP response code, which can be retrieved from ResponseText#code for “status responses”: * everyTaggedResponse, name is always.
Instance Attribute Details
#data (rw)
ResponseCode represents an IMAP response code, which can be retrieved from ResponseText#code for “status responses”:
- 
every TaggedResponse, name is always “OK”, “NO”, or “BAD”.
- 
any UntaggedResponsewhen name is “OK”, “NO”, “BAD”, “PREAUTH”, or “BYE”.
Note that these “status responses” are confusingly not the same as the STATUS UntaggedResponse (see Net::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:
- 
ALERT, the ResponseText#text contains a special alert that MUST be brought to the user’s attention.
- 
BADCHARSET,#datawill be an array of charset strings, ornil.
- 
CAPABILITY,#datawill be an array of capability strings.
- 
PARSE, the ResponseText#text presents an error parsing a message’s [RFC5322] or [MIME-IMB] headers.
- 
PERMANENTFLAGS, followed by an array of flags. System flags will be symbols, and keyword flags will be strings. See Net::IMAP@System+flags
- 
READ-ONLY, the mailbox was selected read-only, or changed to read-only
- 
READ-WRITE, the mailbox was selected read-write, or changed to read-write
- 
TRYCREATE, when Net::IMAP#append or Net::IMAP#copy fail because the target mailbox doesn’t exist.
- 
UIDNEXT,#datais an Integer, the next UID value of the mailbox. See [IMAP4rev1], §2.3.1.1, “Unique Identifier (UID) Message Attribute.
- 
UIDVALIDITY,#datais an Integer, the UID validity value of the mailbox. See [IMAP4rev1], §2.3.1.1, “Unique Identifier (UID) Message Attribute.
- 
UNSEEN,#datais an Integer, the number of messages which do not have the\Seenflag set. DEPRECATED by IMAP4rev2.
BINARY extension
See [RFC3516].
- 
UNKNOWN-CTE, with a taggedNOresponse, when the server does not known how to decode a CTE (content-transfer-encoding). #data isnil. See IMAP#fetch.
UIDPLUS extension
See [RFC4315 §3].
- 
APPENDUID,#dataisUIDPlusData. See Net::IMAP#append.
- 
COPYUID,#dataisUIDPlusData. See Net::IMAP#copy.
- 
UIDNOTSTICKY,#dataisnil. See Net::IMAP#select.
SEARCHRES extension
See [RFC5182].
- 
NOTSAVED, with a taggedNOresponse, when the search result variable is not saved. #data isnil.
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:
- 
UNAVAILABLE
- 
AUTHENTICATIONFAILED
- 
AUTHORIZATIONFAILED
- 
EXPIRED
- 
PRIVACYREQUIRED
- 
CONTACTADMIN
- 
NOPERM
- 
INUSE
- 
EXPUNGEISSUED
- 
CORRUPTION
- 
SERVERBUG
- 
CLIENTBUG
- 
CANNOT
- 
LIMIT
- 
OVERQUOTA
- 
ALREADYEXISTS
QRESYNC extension
See [RFC7162].
- 
CLOSED, returned when the currently selected mailbox is closed implicitly by selecting or examining another mailbox. #data isnil.
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:
- 
HASCHILDREN, with a tagged NOresponse, when a mailbox delete failed because the server doesn’t allow deletion of mailboxes with children. #data isnil.
CONDSTORE extension
See [RFC7162].
- 
NOMODSEQ, when selecting a mailbox that does not support mod-sequences. #data isnil. See IMAP#select.
- 
HIGHESTMODSEQ,#datais an Integer, the highest mod-sequence value of all messages in the mailbox. See IMAP#select.
- 
MODIFIED,#datais aSequenceSet, the messages that have been modified since theUNCHANGEDSINCEmod-sequence given toSTOREorUID STORE.
OBJECTID extension
See [RFC8474].
- 
MAILBOXID,#datais a string
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.
#name (rw)
ResponseCode represents an IMAP response code, which can be retrieved from ResponseText#code for “status responses”:
- 
every TaggedResponse, name is always “OK”, “NO”, or “BAD”.
- 
any UntaggedResponsewhen name is “OK”, “NO”, “BAD”, “PREAUTH”, or “BYE”.
Note that these “status responses” are confusingly not the same as the STATUS UntaggedResponse (see Net::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:
- 
ALERT, the ResponseText#text contains a special alert that MUST be brought to the user’s attention.
- 
BADCHARSET, #data will be an array of charset strings, ornil.
- 
CAPABILITY, #data will be an array of capability strings.
- 
PARSE, the ResponseText#text presents an error parsing a message’s [RFC5322] or [MIME-IMB] headers.
- 
PERMANENTFLAGS, followed by an array of flags. System flags will be symbols, and keyword flags will be strings. See Net::IMAP@System+flags
- 
READ-ONLY, the mailbox was selected read-only, or changed to read-only
- 
READ-WRITE, the mailbox was selected read-write, or changed to read-write
- 
TRYCREATE, when Net::IMAP#append or Net::IMAP#copy fail because the target mailbox doesn’t exist.
- 
UIDNEXT, #data is an Integer, the next UID value of the mailbox. See [IMAP4rev1], §2.3.1.1, “Unique Identifier (UID) Message Attribute.
- 
UIDVALIDITY, #data is an Integer, the UID validity value of the mailbox. See [IMAP4rev1], §2.3.1.1, “Unique Identifier (UID) Message Attribute.
- 
UNSEEN, #data is an Integer, the number of messages which do not have the\Seenflag set. DEPRECATED by IMAP4rev2.
BINARY extension
See [RFC3516].
- 
UNKNOWN-CTE, with a taggedNOresponse, when the server does not known how to decode a CTE (content-transfer-encoding). #data isnil. See IMAP#fetch.
UIDPLUS extension
See [RFC4315 §3].
- 
APPENDUID, #data isUIDPlusData. See Net::IMAP#append.
- 
COPYUID, #data isUIDPlusData. See Net::IMAP#copy.
- 
UIDNOTSTICKY, #data isnil. See Net::IMAP#select.
SEARCHRES extension
See [RFC5182].
- 
NOTSAVED, with a taggedNOresponse, when the search result variable is not saved. #data isnil.
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:
- 
UNAVAILABLE
- 
AUTHENTICATIONFAILED
- 
AUTHORIZATIONFAILED
- 
EXPIRED
- 
PRIVACYREQUIRED
- 
CONTACTADMIN
- 
NOPERM
- 
INUSE
- 
EXPUNGEISSUED
- 
CORRUPTION
- 
SERVERBUG
- 
CLIENTBUG
- 
CANNOT
- 
LIMIT
- 
OVERQUOTA
- 
ALREADYEXISTS
QRESYNC extension
See [RFC7162].
- 
CLOSED, returned when the currently selected mailbox is closed implicitly by selecting or examining another mailbox. #data isnil.
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:
- 
HASCHILDREN, with a tagged NOresponse, when a mailbox delete failed because the server doesn’t allow deletion of mailboxes with children. #data isnil.
CONDSTORE extension
See [RFC7162].
- 
NOMODSEQ, when selecting a mailbox that does not support mod-sequences. #data isnil. See IMAP#select.
- 
HIGHESTMODSEQ, #data is an Integer, the highest mod-sequence value of all messages in the mailbox. See IMAP#select.
- 
MODIFIED, #data is aSequenceSet, the messages that have been modified since theUNCHANGEDSINCEmod-sequence given toSTOREorUID STORE.
OBJECTID extension
See [RFC8474].
- 
MAILBOXID, #data is a string
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.