This Python script uses the simplegmail package to mark an email as important or put it in the trash based on the sender's email address. The sender's address is compared to a list of emails that you have saved in a CSV file. The script has you to input an age range for the emails. The script will look for emails older than a given number of days and newer than a given number of days.
- Marks emails from specific addresses as important
- Trashes all other emails
- Counts the number of emails marked as important and trashed
- Python 3.x
- simplegmailpackage
- csvmodule
- remodule
- 
Install the required packages: pip install simplegmail 
- 
Follow the setup instructions for simplegmailto configure authentication with your Gmail account: simplegmail Setup
- 
Prepare a CSV file ( important_addresses.csv) with a header row and a column namedemailcontaining important email addresses.
- 
Edit the script (very end) to specify the age range of emails to process by modifying the older_than_daysandnewer_than_daysvariables.
- 
Run the script: python mark_emails.py