Send email with Gmail and Python using OAuth, to protect your password
Send email with Gmail and Python using OAuth, to protect your password
Based on Gmail dev docs tutorial:
https://developers.google.com/gmail/api/quickstart/python
Make sure to follow the step to enable API for Gmail and download a JSON file.
Install dependencies.
Run the script.
You'll have to follow the auth flow once to sign to Gmail and after that the details will be referenced from a store.
See also tutorial which uses a less secure approach and requires you to allow less secure apps.
https://realpython.com/python-send-email/
See other sample scripts for Google suite.