pymap.exceptions

Module containing the general exceptions that may be used by pymap.

exception pymap.exceptions.ResponseError[source]

The base exception for all custom errors that are used to generate a response to an IMAP command.

abstract get_response(tag)[source]

Build an IMAP response for the error.

Parameters:

tag (bytes) – The command tag that generated the error.

Return type:

Response

exception pymap.exceptions.CloseConnection[source]

Raised when the connection should be closed immediately after sending the provided response.

get_response(tag)[source]

Build an IMAP response for the error.

Parameters:

tag (bytes) – The command tag that generated the error.

Return type:

ResponseOk

exception pymap.exceptions.NotSupportedError(msg='Operation not supported.')[source]

Raised when an action is taken that might be syntactically valid, but is not supported by the server or backend.

Parameters:

msg (str)

Return type:

None

get_response(tag)[source]

Build an IMAP response for the error.

Parameters:

tag (bytes) – The command tag that generated the error.

Return type:

ResponseNo

exception pymap.exceptions.TemporaryFailure(msg)[source]

The operation failed, but may succeed if tried again. The [INUSE] response code is added to the response.

Parameters:

msg (str)

Return type:

None

get_response(tag)[source]

Build an IMAP response for the error.

Parameters:

tag (bytes) – The command tag that generated the error.

Return type:

ResponseNo

exception pymap.exceptions.SearchNotAllowed(key)[source]

The SEARCH command contained a search key that could not be executed by the mailbox.

Parameters:

key (SearchKey) – The search key that failed.

Return type:

None

exception pymap.exceptions.InvalidAuth(msg='Invalid authentication credentials.')[source]

The LOGIN or AUTHENTICATE commands received credentials that the IMAP backend has rejected.

Parameters:

msg (str)

Return type:

None

get_response(tag)[source]

Build an IMAP response for the error.

Parameters:

tag (bytes) – The command tag that generated the error.

Return type:

ResponseNo

exception pymap.exceptions.AuthorizationFailure(msg='Authorization failed.')[source]

The credentials in LOGIN or AUTHENTICATE were authenticated but failed to authorize as the requested identity.

Parameters:

msg (str)

Return type:

None

get_response(tag)[source]

Build an IMAP response for the error.

Parameters:

tag (bytes) – The command tag that generated the error.

Return type:

ResponseNo

exception pymap.exceptions.NotAllowedError(msg='Operation not allowed.')[source]

The operation is not allowed due to access controls.

Parameters:

msg (str)

Return type:

None

get_response(tag)[source]

Build an IMAP response for the error.

Parameters:

tag (bytes) – The command tag that generated the error.

Return type:

ResponseNo

exception pymap.exceptions.IncompatibleData(msg='Incompatible mailbox data.')[source]

The LOGIN or AUTHENTICATE command could not succeed because the detected mailbox data was not in a compatible format.

Parameters:

msg (str)

Return type:

None

exception pymap.exceptions.MailboxError(mailbox, message, code=None)[source]

Parent exception for errors related to a mailbox.

Parameters:
  • mailbox (str | None) – The name of the mailbox.

  • message (bytes) – The response message for the error.

  • code (ResponseCode | None) – Optional response code for the error.

Return type:

None

get_response(tag)[source]

Build an IMAP response for the error.

Parameters:

tag (bytes) – The command tag that generated the error.

Return type:

ResponseNo

exception pymap.exceptions.MailboxNotFound(mailbox, *, try_create=False)[source]

The requested mailbox was not found.

Parameters:
  • mailbox (str) – The name of the mailbox

  • try_create (bool) – True if creating the mailbox first may help.

Return type:

None

exception pymap.exceptions.MailboxConflict(mailbox)[source]

The mailbox cannot be created or renamed because of a naming conflict with another mailbox.

Parameters:

mailbox (str) – The name of the mailbox.

Return type:

None

exception pymap.exceptions.MailboxHasChildren(mailbox)[source]

The mailbox cannot be deleted because there are other inferior hierarchical mailboxes below it.

Parameters:

mailbox (str) – The name of the mailbox.

Return type:

None

exception pymap.exceptions.MailboxReadOnly(mailbox=None)[source]

The mailbox is opened read-only and the requested operation is not allowed.

Parameters:

mailbox (str | None) – The name of the mailbox.

Return type:

None

exception pymap.exceptions.AppendFailure(mailbox, message, code=None)[source]

The mailbox append operation failed.

Parameters:
Return type:

None

exception pymap.exceptions.UserNotFound[source]

The requested user was not found.

get_response(tag)[source]

Build an IMAP response for the error.

Parameters:

tag (bytes) – The command tag that generated the error.

Return type:

ResponseNo

exception pymap.exceptions.CannotReplaceUser[source]

The existing user cannot be replaced.

get_response(tag)[source]

Build an IMAP response for the error.

Parameters:

tag (bytes) – The command tag that generated the error.

Return type:

ResponseNo