Send email messages through a specified Gmail account.
-
Download Pylio and its dependancies
pip install pylio
-
Turn on Gmail API by clicking Enable Gmail API on Gmail
- Select + Create a new project.
- Download the credentials file to access your Gmail account.
- Move the downloaded file to your working directory and ensure it is named
credentials.json
.
You can also specify the location ofcredentials.json
either inconfig.yaml
or using the--cred-file
flag.
-
From command line: use
pylio
with the below arguments. Default arguments will come from theconfig.yaml
unless otherwise stated.
Command line override arguments:
--to email_address
email address of intented recepient
--message msg_body
text body of email
--config-file path
(optional) path to custom configuration file; default isconfig.yaml
--cred-file path
(optional) path to Google Gmail credentials JSON file
--subject subject_line
(optional) subject line of email
config.yaml
Default configuration file to specify to, message, and Google credentials file
PylioMail.py
Class using Google API
setup.py
pip file
This repository is a wrapper that simplifies the use of the Google Gmail API.
- Check if authorization is enabled: Google Authorization
- Make sure
https://www.googleapis.com/auth/gmail.send
is chosen in authorization.