/cleanmail

A simple python application to clean and tidy my gmail account

Primary LanguagePython

Introduction

This is a tool to delete mails by senders or domains. We first analyze your mailbox (This process takes time). Once done, we show you the count of mails per sender. You can then mark and select the senders whose mails you want to delete. We also show you a list of links from which you should unsubscribe, to avoid junk mails

Note:

  • Please take care while marking mails for deletion, mails once deleted cannot be restored. We also recommend you should take a backup of your mails.
  • We initially ask for read permissions only, delete permissions will be asked as and when required.
  • Using this tool, I reduced the size of my mailbox from 37000+ to 4000 mails

Installation

  1. Get Gmail token

    1. Option 1: Get sample token
      1. Goto https://developers.google.com/gmail/api/quickstart/python
      2. Click on "ENABLE THE GMAIL API"
      3. Click "Download client configration"
    2. Option 2: Create a gmail token
      1. Goto https://console.developers.google.com
      2. Create a new project
      3. Select the project and click on "ENABLE APIS AND SERVICES"
      4. Search for "Gmail API" and click "Enable"
      5. Click on "Create Credentails"
      6. Select "Gmail API", UI Type : "Other UI" and Access : "User Data"
      7. Click next
      8. If prompted, click "Create Consent Screen"
      9. Type Application Name and keep scope public.
      10. Go to previous tab, type any client id
      11. Click on done and download the key
  2. Copy the token in ./tokens as credentails.json. Delete the existing file.

  3. Install the following

    1. pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
  4. Run the script: python CLI.py

Contact