Skip to content

Interact with your gmail account over the command line for quick batch operations. this currently only supports delete functionality by label or sender keyword.

License

Notifications You must be signed in to change notification settings

CHBaker/gmail-cli-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

gmail-cli-handler

Interact with your gmail account over the command line for quick batch operations. this currently only supports delete functionality by label or sender keyword.

Setup

takes roughly 10 minutes

  1. Follow the python quickstart gmail API Docs to create a project, enable the gmail api, and download the credentials.

  2. Rename the downloaded JSON file to credentials.json and copy it to the same directory as email_handler.py

Run The Script

  1. Navigate to the directory you copied the script to.

  2. Run the script and add the input variables: and . Label must be exact, but sender is a keyword search.

  3. Ex: $ python email_handler.py label='work' sender='[email protected]'

  4. The script will open your browser to verify the OAUTH2 with the client and your gmail account.

  5. Follow the command line prompst, the script will always ask before the final deletion of emails.

NOTE

The gmail API does not allow instant and total deletion

This script just moves emails to the trash folder, which is cleared according to your settings

To allow instant and total deletion, you must submit a form to register your api with google, since this can be a security issue/dangerous if not used properly.

Resources

python quickstart gmail API Docs

builder API methods, handles all gmail interactions

gmail API http response types and query params

About

Interact with your gmail account over the command line for quick batch operations. this currently only supports delete functionality by label or sender keyword.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages