pymap.message
¶
Base implementations of the pymap.interfaces.message
interfaces.
- class pymap.message.BaseMessage(uid, internal_date, permanent_flags, *, email_id=None, thread_id=None, expunged=False)[source]¶
Message metadata such as UID, permanent flags, and when the message was added to the system.
- Parameters:
uid (int) – The UID of the message.
internal_date (datetime) – The internal date of the message.
permanent_flags (Iterable[Flag]) – Permanent flags for the message.
email_id (ObjectId | None) – The message content identifier for the message.
thread_id (ObjectId | None) – The thread identifier for the message.
expunged (bool) – True if this message has been expunged from the mailbox.
- property email_id: ObjectId¶
The message’s email object ID, which can identify its content.
See also
- property thread_id: ObjectId¶
The message’s thread object ID, which groups messages together.
See also
- get_flags(session_flags)[source]¶
Get the full set of permanent and session flags for the message.
- Parameters:
session_flags (SessionFlags) – The current session flags.
- Return type:
- class pymap.message.BaseLoadedMessage(message, requirement, content)[source]¶
The loaded message content, implemented using an instance of
MessageContent
.- Parameters:
message (MessageInterface) – The message object.
requirement (FetchRequirement) – The fetch requirement of the loaded content.
content (MessageContent | None) – The MIME-parsed message content, if available.
- property requirement: FetchRequirement¶
The
FetchRequirement
used to load the message content.
- get_headers(section)[source]¶
Get the headers from the message part.
The
section
argument indexes a nested sub-part of the message. For example,[2, 3]
would get the 2nd sub-part of the message and then index it for its 3rd sub-part.
- get_body(section=None, binary=False)[source]¶
Get the full body of the message part, including headers.
The
section
argument can index a nested sub-part of the message. For example,[2, 3]
would get the 2nd sub-part of the message and then index it for its 3rd sub-part.
- get_message_headers(section=None, subset=None, inverse=False)[source]¶
Get the headers from the message or a
message/rfc822
sub-part of the message..The
section
argument can index a nested sub-part of the message. For example,[2, 3]
would get the 2nd sub-part of the message and then index it for its 3rd sub-part.
- get_message_text(section=None)[source]¶
Get the text of the message part, not including headers.
The
section
argument can index a nested sub-part of the message. For example,[2, 3]
would get the 2nd sub-part of the message and then index it for its 3rd sub-part.