Create draft messages in Gmail
Project description
Gmail Drafter: Create Mail Merge Drafts
Simple tool to take a CSV and a template and create drafts in your Gmail. Useful for sending emails to large-ish numbers of people where you want to slightly customize the emails for each user. You can quickly run through drafts, customize it, and send.
Installation
pip install gmail-draft-creator
Usage
Usage: gmail-draft-creator [OPTIONS]
Options:
--csv PATH Path to the CSV file. [required]
--template PATH Path to the template file. [required]
--subject TEXT Subject for the email drafts. [required]
--dry-run Run script without creating drafts.
--help Show this message and exit.
You can also import the create_draft
function and use it in your own scripts.
Setup
Generating a Gmail API Token
- Navigate to the Google Cloud Console. https://console.developers.google.com/
- Create a new project or select an existing one.
- Go to "APIs & Services" -> "Library" and enable the Gmail API.
- Navigate to "APIs & Services" -> "Credentials".
- Click "Create Credentials" -> "OAuth client ID".
- Select "Desktop app" as the application type, then click "Create".
- Download the JSON file, rename it to
credentials.json
, and place it in the root of your project. - Run the script and oauth into your account
Credential Scopes Needed
- https://www.googleapis.com/auth/gmail.compose
- https://www.googleapis.com/auth/gmail.readonly
- https://www.googleapis.com/auth/calendar.readonly
- https://www.googleapis.com/auth/calendar.event
Some of these are in place for possible future improvements.
TODO
- add credentials as a command line argument
- add serialized token as a CLI argument
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for gmail_draft_creator-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 340ebbce2ef38d6518f2f05feef3fc8414d3915c1c92c44380a44cafee090ced |
|
MD5 | c97433fadf9061dccdbb7bfbfc295ae4 |
|
BLAKE2b-256 | 09f44d7c918eb4687f184e6e595a309fd7f621ece84101dadae7199ef020f818 |
Close
Hashes for gmail_draft_creator-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fc91bd610d5ee791ab69e0f6f2ae4848180bb19f1207743c75c27bf9d163f9f |
|
MD5 | 27cee0b08f1444a0102323ceb25a9969 |
|
BLAKE2b-256 | ba4a22c04c5a759a849d4691692b8c7bbcca67c027cce0d848349cd2e07b5430 |