Currently, Gmail is limited to deleting 50 emails per cycle, which is incredibly tedious for someone who harbors +1000 unread email messages. This program is meant to automate this process.
- Overview:
- Deletes 95% of unread messages on its first run, and 100% on its second one.
- It will take an average of 5 seconds to evaluate and delete every 50 emails.
- This a limitation determined by Gmail, because the program MUST wait for the emails to load, in order to delete them. If you have a fast internet connection, you may be able to run the program faster than this.
-
- If using VS Code, you should also install the Python extension for VS Code.
-
-
On Chrome url bar, type chrome://version, and record the official Build number (ex. 93.04577.82)
-
Download and unzip the appropriate chrome driver from : https://sites.google.com/chromium.org/driver/
- Ex: If Chrome Build number is 93.04577.92, download the 93.0.4577.63 chrome driver
-
Create a new folder called chromeDriver, and move it to your local C:/ directory
-
Move chromeDriver.exe into chromedriver folder. Below is an example
-
-
- You MUST disable 2-factor authentication on the Google Account you are trying to access
- You MUST give less secure apps access to your gmail account.
- Undo these settings after running the program, so your Google account and data remains secure.
-
- Set up a virtual environment in project directory
- Run
py -m venv virtual
from terminal
- Run
- Set up a virtual environment in project directory
- Run
pip install -r requirements.txt
in project directory, using the terminal- if using a virtual environment, ensure it is active before running this command.
- Overview of modules and libraries requried
- selenium
- Selenium Documentation : https://www.selenium.dev
- selenium_stealth
- Selenium Stealth Documentation : https://openbase.com/python/selenium-stealth/documentation
- selenium
- If you are using an IDE, you can easily click on the play button on the index.py file.
- You may also run this program from the terminal
- This program REQUIRES you to manually input your username/email, and click the next button.
- This is due to Google's incredibly tough and secure bot detection algorithms. If this were completely automated, the user would be unable to sign into their account due to secruity risks. However, after manually entering your username/email and clicking next, everything from inputting your password to deletion of emails, is completely automated
- If you are trying to enter an organization email (i.e cornell.edu, etc) you need to remove the code that automates entering a password. Below is the code that needs to be removed:
def signIn(): #user is given 40 sec to manually type in username and click next time.sleep(40) # to use this script for organization emails (i.e cornell.edu, job.com, etc) # comment the bottom 4 lines out and manually input both username and password passWordBox = driver.find_element_by_xpath( '//*[@id ="password"]/div[1]/div / div[1]/input') passWordBox.send_keys(password) nextBtn = driver.find_element_by_xpath('//*[@id ="passwordNext"]') nextBtn.click()
- You are given 40 seconds to manually input this information, but its duration can be increased in the index.py file.
- This code runs optimally on Google Chrome version 93.0.4577.82, as of Sept 18th, 2021.
- If run on a different verison, setup portion of code may need adjustments
- This project will not be maintained by owner, but feel free to use it as a template for your own projects
- Do not create a verison of this program that infringes upon the privacy rights of others.