Skip to main content

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

  1. Navigate to the Google Cloud Console. https://console.developers.google.com/
  2. Create a new project or select an existing one.
  3. Go to "APIs & Services" -> "Library" and enable the Gmail API.
  4. Navigate to "APIs & Services" -> "Credentials".
  5. Click "Create Credentials" -> "OAuth client ID".
  6. Select "Desktop app" as the application type, then click "Create".
  7. Download the JSON file, rename it to credentials.json, and place it in the root of your project.
  8. Run the script and oauth into your account

Credential Scopes Needed

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

gmail_draft_creator-1.0.1.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

gmail_draft_creator-1.0.1-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page