pyOutlook.internal package¶
Submodules¶
pyOutlook.internal.createMessage module¶
-
class
pyOutlook.internal.createMessage.
NewMessage
(token)¶ Bases:
object
A constructor for new emails.
Each method, excluding send(), returns the NewMessage object allowing chaining of methods.
-
add_attachment
(file_bytes, file_name, file_extension)¶ Adds an attachment to the email.
Warning
This method is deprecated, use NewMessage.attach() instead. If using this method, you must base64 encode the file_bytes.
-
attach
(file_bytes, file_name, file_extension)¶ Adds an attachment to the email.
Warning
This method does minimal escaping of input for the file_name. Slashes and periods will both be replaced by dashs (/), (.) > (-). Outlook may cut off portions of the file name due to some characters, if you encounter one, please create an issue on this module’s GitHub: https://github.com/JensAstrup/pyOutlook/issues.
Notes
You can send any file with this method, so long as the content is provided in bytes. Not doing so may lead to malformed attachments. You can also send bytes in a format that was not created in the same extension as the one provided to this method. For example, CSV bytes sent through with an xlsx extension will be attached and usable as an Excel document.
Parameters: - file_bytes – The bytes of the file to send
- file_name – The name of the file, as a string and leaving out the extension, that should be sent
- file_extension – The extension type (pdf, csv, etc) of the attachment. Do not include the ‘.’ in the string.
Returns: NewMessage
-
bcc
(recipients)¶ The list of email addresses that should be ‘blind’ copied on this email.
Parameters: recipients – A comma separated string of email addresses, or a list of strings. Returns: NewMessage
-
cc
(recipients)¶ The list of email addresses that should be copied on this email.
Parameters: recipients – A comma separated string of email addresses, or a list of strings. Returns: NewMessage
-
send
()¶ Sends the email containing the information provided in the other methods.
Raises: SendError
– Occurs if a subject or to recipients are not definedMiscError
– Occurs if Outlook responds with anything other than a 202, generally as a result of an expired- or invalid access token.
-
send_as
(email)¶ Send the email via a separate email address, which the OutlookAccount has access to.
Parameters: email – A string providing the secondary email address that this email should be sent through. Returns: NewMessage
-
set_body
(body)¶ Sets the body of the email.
Parameters: body – str Returns: NewMessage
-
set_subject
(subject)¶ Sets the subject for the email.
This method is required in order to send the email.
Parameters: subject – str Returns: NewMessage
-
to
(recipients)¶ The list of email addresses this email should be sent to.
This method is required in order to send the email. The recipients parameter can either be a single address string or a comma separated list of addresses provided as a string.
Examples
>>> email.to('john@domain.com') >>> email.to('john@domain.com, jane@domain.com')
Parameters: recipients – A comma separated string of email addresses, or a list of strings. Returns: NewMessage
-
pyOutlook.internal.errors module¶
-
exception
pyOutlook.internal.errors.
AuthError
(value)¶ Bases:
Exception
-
exception
pyOutlook.internal.errors.
MiscError
(value)¶ Bases:
Exception
-
exception
pyOutlook.internal.errors.
SendError
(value)¶ Bases:
Exception
pyOutlook.internal.internalMethods module¶
pyOutlook.internal.messageActions module¶
-
pyOutlook.internal.messageActions.
forward_message
(self, message_id, to_recipients, forward_comment)¶
-
pyOutlook.internal.messageActions.
reply
(self, message_id, reply_comment, reply_all)¶
pyOutlook.internal.retrieve module¶
-
pyOutlook.internal.retrieve.
clean_return_multiple
(json)¶ Parameters: json – Returns: List of messages Return type: list of Message
-
pyOutlook.internal.retrieve.
clean_return_single
(json)¶
-
pyOutlook.internal.retrieve.
get_inbox
(self)¶
-
pyOutlook.internal.retrieve.
get_message
(self, message_id)¶
-
pyOutlook.internal.retrieve.
get_messages
(self, skip)¶ Parameters: - self –
- skip –
Returns: List[Message]
-
pyOutlook.internal.retrieve.
get_messages_from_folder_id
(self, folder_id)¶ Parameters: - self –
- folder_id –
Returns: List[Message]
-
pyOutlook.internal.retrieve.
get_messages_from_folder_name
(self, folder_name)¶ Parameters: - self –
- folder_name –
Returns: List[Message]