A lightweight (requiring only one external dependency - requests to run) python wrapper over the user: sendMail MSGraph API endpoint, allowing you to easily integrate mail functionality into any Python workflow.
Supports including file attachments, mail importance, CC recipients, and BCC recipients, among other features.
Note: While the wrapper does only require requests to run, you do need to have build and wheel installed to build the package from source.
To build and import the package you need to install:
requests==2.32.3
or rather
pip install -r requirements.txt
- Enterprise application with OAuth credentials, and permission to use the SendMail Graph API endpoint
- An existing user account to source the email from
Please check out the example_usage.py file to learn how to use the package! It's fairly simple overall.
This package implements a custom header attached to each message (email) it sends to the Microsoft Graph API. This is done for the express purpose of making it easier to identify emails sent via this package in other automated workflows. This was implemented as sending tons of emails with this script might result in your mailbox becoming full. You can then write subsequent automation to remove sent messages with this header.
The header is set as follows::
{"name": "x-SentBySimpleSendMail", "value": "true"}