MessageMetadata class
This is the full description of the MessageMetadata class.
- class google_workspace.gmail.message.MessageMetadata
A message that includes only email message ID, labels, and email headers. This message is returned for the “metadata” message format.
- Parameters
gmail_client (
GmailClient
) – The gmail_client.message_data (
dict
) – The raw message data.
- in_reply_to
The message id of the message this message replies to.
- references
The message ids of the messages this message is a reply to.
- is_reply
Whether the message is a reply or not.
- message_id
A string of the the message id.
- subject
A string of the message subject.
- raw_from
A string of the message’s From header which can be used when sending messages to include the name.
- raw_to
A list of the message’s To header in it’s original form.
- raw_cc
A list of the message’s Cc header in it’s original form.
- raw_bcc
A list of the message’s Bcc header in it’s original form.
- to
A list of the message’s To header with the email addresses only.
- cc
A list of the message’s Cc header with the email addresses only.
- bcc
A list of the message’s Bcc header with the email addresses only.
- raw_from_name
A string of the from name, potentially encoded.
- from_
A string of the email address of the sender.
- from_name
A string with the senders name decoded.
- raw_date
A string of the message date in it’s original form.
- date
A Datetime object with the message’s date.
- is_bulk
A boolean set to True when the message has the Precedence header set to bulk.
- gmail_client
The gmail client.
- message_data
The raw message data from the API.
- gmail_id
The message id used for the API.
- thread_id
The messgae thread ID.
- label_ids
A list of labels.
- snippet
A short snippet from the message.
- is_seen
Whether the message is marked as read or not.
- is_chat_message
If this message is a chat message.
- add_labels(label_ids: Union[list, str]) dict
Add labels to this message.
- Parameters
label_ids (
list
|str
) – The lables to add.- Returns
The API response.
- Return type
dict
- delete() dict
Delete this message permanently.
- Returns
The API response.
- Return type
dict
- get_full_message() google_workspace.gmail.message.Message
Download the full message. Downloads the message using the “raw” format.
- Returns
The full message.
- Return type
- get_header(header: str) Optional[str]
Get a header from this message.
- Parameters
header (
str
) – The header name.- Returns
If the header was found this will return the header value, otherwise it will return None.
- Return type
str
| None
-
get_thread(message_format: Optional[Literal[
'minimal','full','metadata']] = None) google_workspace.gmail.thread.Thread Get the message’s full thread.
- Parameters
message_format (
str
, optional) – In which format to retrieve the messages. Can have one of the following values:"minimal"
,"full"
,"metadata"
. If this is not set we default to the format of the current message. Defaults to None.- Returns
The full thread.
- Return type
- mark_read() dict
Mark this message as read.
- Returns
The API response.
- Return type
dict
- mark_unread() dict
Mark this message as unread.
- Returns
The API response.
- Return type
dict
- remove_labels(label_ids: Union[list, str]) dict
Remove labels from this message.
- Parameters
label_ids (
list
|str
) – The lables to remove.- Returns
The API response.
- Return type
dict
- trash() dict
Move this message to the trash.
- Returns
The API response.
- Return type
dict
- untrash() dict
Untrash this message.
- Returns
The API response.
- Return type
dict