pymap.mailbox

Base implementation of the pymap.interfaces.mailbox interfaces.

class pymap.mailbox.MailboxSnapshot(mailbox_id, readonly, uid_validity, permanent_flags, session_flags, exists, recent, unseen, first_unseen, next_uid)[source]

Implements the full functionality of a mailbox using entirely static arguments to the constructor. Backends can create and return a new mailbox snapshot every time a MailboxInterface is required.

Parameters:
  • mailbox_id (ObjectId) – The mailbox ID.

  • readonly (bool) – If True, the mailbox is read-only.

  • uid_validity (int) – The UID validity value for mailbox consistency.

  • permanent_flags (Iterable[Flag]) – The permanent flags defined in the mailbox.

  • session_flags (frozenset[Flag]) – The session flags defined in the mailbox.

  • exists (int) – Number of total messages in the mailbox.

  • recent (int) – Number of recent messages in the mailbox.

  • unseen (int) – Number of unseen messages in the mailbox.

  • first_unseen (int | None) – The sequence number of the first unseen message.

  • next_uid (int) – The predicted next message UID.

classmethod new_uid_validity()[source]

Generate a new UID validity value for a mailbox, where the first two bytes are time-based and the second two bytes are random.

Return type:

int

property flags: frozenset[Flag]

Set of all permanent and session flags available on the mailbox.