项目作者: CHBaker

项目描述 :
Interact with your gmail account over the command line for quick batch operations. this currently only supports delete functionality by label or sender keyword.
高级语言: Python
项目地址: git://github.com/CHBaker/gmail-cli-handler.git
创建时间: 2018-10-05T21:30:38Z
项目社区:https://github.com/CHBaker/gmail-cli-handler

开源协议:MIT License

下载


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:

  3. Ex: $ python email_handler.py label='work' sender='myboss@msn.com'

  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