Message¶
-
class
O365.message.
Flag
(value)[source]¶ Bases:
O365.utils.utils.CaseEnum
An enumeration.
-
Complete
= 'complete'¶
-
Flagged
= 'flagged'¶
-
NotFlagged
= 'not_flagged'¶
-
-
class
O365.message.
MeetingMessageType
(value)[source]¶ Bases:
O365.utils.utils.CaseEnum
An enumeration.
-
MeetingAccepted
= 'meeting_accepted'¶
-
MeetingCancelled
= 'meeting_cancelled'¶
-
MeetingDeclined
= 'meeting_declined'¶
-
MeetingRequest
= 'meeting_request'¶
-
MeetingTentativelyAccepted
= 'meeting_tentatively_accepted'¶
-
-
class
O365.message.
Message
(*, parent=None, con=None, **kwargs)[source]¶ Bases:
O365.utils.utils.ApiComponent
,O365.utils.attachment.AttachableMixin
,O365.utils.utils.HandleRecipientsMixin
Management of the process of sending, receiving, reading, and editing emails.
-
__init__
(*, parent=None, con=None, **kwargs)[source]¶ Makes a new message wrapper for sending and receiving messages.
- Parameters
parent (mailbox.Folder or Account) – parent folder/account to create the message in
con (Connection) – connection to use if no parent specified
protocol (Protocol) – protocol to use if no parent specified (kwargs)
main_resource (str) – use this resource instead of parent resource (kwargs)
download_attachments (bool) – whether or not to download attachments (kwargs)
-
property
attachments
¶ List of attachments
-
property
bcc
¶ ‘BCC’ list of recipients
-
property
body
¶ Body of the email message
- Getter
Get body text of current message
- Setter
set html body of the message
- Type
str
-
property
body_preview
¶ Returns the body preview
-
property
categories
¶ Categories of this message
- Getter
Current list of categories
- Setter
Set new categories for the message
- Type
list[str] or str
-
property
cc
¶ ‘CC’ list of recipients
-
copy
(folder)[source]¶ Copy the message to a given folder
- Parameters
folder (str or mailbox.Folder) – Folder object or Folder id or Well-known name to copy this message to
- Returns
the copied message
- Return type
-
property
created
¶ Created time of the message
-
property
flag
¶ The Message Flag instance
-
forward
()[source]¶ Creates a new message that is a forward this message
- Returns
new message
- Return type
-
get_body_soup
()[source]¶ Returns the beautifulsoup4 of the html body
- Returns
BeautifulSoup object of body
- Return type
BeautifulSoup
-
get_body_text
()[source]¶ Parse the body html and returns the body text using bs4
- Returns
body as text
- Return type
str
-
property
importance
¶ Importance of the message
- Getter
Get the current priority of the message
- Setter
Set a different importance level
- Type
str or ImportanceLevel
-
property
is_delivery_receipt_requested
¶ if the delivery receipt is requested for this message
- Getter
Current state of isDeliveryReceiptRequested
- Setter
Set isDeliveryReceiptRequested for the message
- Type
bool
-
property
is_draft
¶ Check if the message is marked as draft
- Type
bool
-
property
is_event_message
¶ Returns if this message is of type EventMessage and therefore can return the related event.
-
property
is_read
¶ Check if the message is read or not
- Getter
Get the status of message read
- Setter
Mark the message as read
- Type
bool
-
property
is_read_receipt_requested
¶ if the read receipt is requested for this message
- Getter
Current state of isReadReceiptRequested
- Setter
Set isReadReceiptRequested for the message
- Type
bool
-
mark_as_read
()[source]¶ Marks this message as read in the cloud
- Returns
Success / Failure
- Return type
bool
-
mark_as_unread
()[source]¶ Marks this message as unread in the cloud
- Returns
Success / Failure
- Return type
bool
-
property
meeting_message_type
¶ If this message is a EventMessage, returns the meeting type: meetingRequest, meetingCancelled, meetingAccepted,
meetingTentativelyAccepted, meetingDeclined
-
property
modified
¶ Message last modified time
-
move
(folder)[source]¶ Move the message to a given folder
- Parameters
folder (str or mailbox.Folder) – Folder object or Folder id or Well-known name to move this message to
- Returns
Success / Failure
- Return type
bool
-
property
received
¶ Message received time
-
reply
(to_all=True)[source]¶ Creates a new message that is a reply to this message
- Parameters
to_all (bool) – whether or not to replies to all the recipients instead to just the sender
- Returns
new message
- Return type
-
property
reply_to
¶ Reply to address
-
save_as_eml
(to_path=None)[source]¶ Saves this message as and EML to the file system :param Path or str to_path: the path where to store this file
-
save_draft
(target_folder=<OutlookWellKnowFolderNames.DRAFTS: 'Drafts'>)[source]¶ Save this message as a draft on the cloud
- Parameters
target_folder – name of the drafts folder
- Returns
Success / Failure
- Return type
bool
-
save_message
()[source]¶ Saves changes to a message. If the message is a new or saved draft it will call ‘save_draft’ otherwise this will save only properties of a message that are draft-independent such as:
is_read
category
flag
- Returns
Success / Failure
- Return type
bool
-
send
(save_to_sent_folder=True)[source]¶ Sends this message
- Parameters
save_to_sent_folder (bool) – whether or not to save it to sent folder
- Returns
Success / Failure
- Return type
bool
-
property
sender
¶ Sender of the message
- Getter
Get the current sender
- Setter
Update the from address with new value
- Type
str or Recipient
-
property
sent
¶ Message sent time
-
property
subject
¶ Subject of the email message
- Getter
Get the current subject
- Setter
Assign a new subject
- Type
str
-
property
to
¶ ‘TO’ list of recipients
-
to_api_data
(restrict_keys=None)[source]¶ Returns a dict representation of this message prepared to be send to the cloud
- Parameters
restrict_keys (dict or set) – a set of keys to restrict the returned data to
- Returns
converted to cloud based keys
- Return type
dict
-
property
unique_body
¶ - The unique body of this message
Requires a select to retrieve it.
- Return type
str
-
-
class
O365.message.
MessageFlag
(parent, flag_data)[source]¶ Bases:
O365.utils.utils.ApiComponent
A flag on a message
-
__init__
(parent, flag_data)[source]¶ An flag on a message Not available on Outlook Rest Api v2 (only in beta)
- Parameters
parent (Message) – parent of this
flag_data (dict) – flag data from cloud
-
property
completition_date
¶
-
property
due_date
¶
-
property
is_completed
¶
-
property
is_flagged
¶
-
set_completed
(*, completition_date=None)[source]¶ Sets this message flag as completed :param completition_date: the datetime this followUp was completed
-
set_flagged
(*, start_date=None, due_date=None)[source]¶ Sets this message as flagged :param start_date: the start datetime of the followUp :param due_date: the due datetime of the followUp
-
property
start_date
¶
-
property
status
¶
-