Simple tool to send email via a GMAIL account. It uses the GMAIL API.
The tool is expected to run from a host with a web browser to run the OAuth2 flow.
At https://developers.google.com/gmail/api/quickstart/python
- Enable the GMAIL API then:
- Enter project name: Perso-Mailer
- Configure your OAuth client: Desktop app
- Click on API Console link
Via the console link or at https://console.cloud.google.com/apis/credentials
- Make sure to have selected: Perso-Mailer project
- Click on OAuth client
- Download JSON, and save the file to ~/.sgms/credentials.json.
pip install --user -r requirements.txt
python setup.py install --user
sgms --auth-only
Create a file message.yaml with content such as
---
to: <mon-gazier>@mail.com
subject: Hey my Friend
body: I wish you a very good day !
Or see example/message.yaml as en example.
The email to send must be provided as a YAML payload.
sgms --from-email user@gmail.com --yaml-message mail.yaml
Prepare a directory with some messages as YAML files and run:
sgms --from-email user@gmail.com --yaml-directory pool/
Message files that have been sent are renamed with the prefix sent and won't be proceed the next call of the command.