Main College Spam Checker setup. CSC first asks for the email server to log into. CSC also does autofill for Gmail, Yahoo, and Outlook.com, and prompts to turn off less secure apps when needed.  After that, you need to enter your username and passwo

College Spam Checker

College Spam Checker (also stylized as CollegeSpamChecker, or CSC) is an experimental tool I made using imaplib to check which colleges were spamming my inbox the most with college emails.

I’ve slowly developed the tool to have cool features, such as multi-threading, and easy support for Gmail/Yahoo Mail/Outlook.com. Future features might include doing time-based analysis, or even turning this into a Flask app.

Lines of code: ~200

Language: Python

Timeframe: August 2018 - Present

You can view the source code for this project here.

 Main College Spam Checker setup. CSC first asks for the email server to log into. CSC also does autofill for Gmail, Yahoo, and Outlook.com, and prompts to turn off less secure apps when needed.  After that, you need to enter your username and passwo

Main College Spam Checker setup. CSC first asks for the email server to log into. CSC also does autofill for Gmail, Yahoo, and Outlook.com, and prompts to turn off less secure apps when needed.

After that, you need to enter your username and password to log in. Once that’s all settled, CSC lists the inboxes to look in with numbers. In this case, I’d enter 11 because I want to check for mail in the College Spam folder.

 The second portion of CSC setup involves configuring the number of threads to use. CSC is multi-threaded, but email servers have concurrent connection limitations, and will throw errors if there’s too many connections.  In this example, I set it to

The second portion of CSC setup involves configuring the number of threads to use. CSC is multi-threaded, but email servers have concurrent connection limitations, and will throw errors if there’s too many connections.

In this example, I set it to the default of 5 threads, and away it goes! CSC takes about 45 seconds to check for 4,000 emails from my own email server (this varies A LOT depending on email server, internet connection, etc)

 Once all is done, CSC uses PrettyTable to output a list of senders from most emails sent to least emails sent. To avoid table overflow, the max characters per line for the sender name is 79, with sender names over this flowing into new lines.  You c

Once all is done, CSC uses PrettyTable to output a list of senders from most emails sent to least emails sent. To avoid table overflow, the max characters per line for the sender name is 79, with sender names over this flowing into new lines.

You can see that Stetson University ranks number one with 116 emails sent, and the list goes down from there.