Skip to content

Instantly share code, notes, and snippets.

@kjoconnor
kjoconnor / clean_gmail_emails.py
Created January 23, 2020 15:09
I used this script to delete a bunch of cron emails that had built up in my inbox. You should be able to change the search params to cover anything you might want to get rid of. Note this will _permanently delete_, not just move to trash.
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://mail.google.com/']