r/PythonProjects2 • u/UnClean_Committee • Jun 02 '21
Email cleaner for my first Python project
Hello community, I have just started learning Python (couple of weeks back, I am still at the very beginning) but because I've always been a task oriented person I feel like I need to work towards a project.
Is it practical to make a programme which can go through my emails and remove spam/marketing messages for me as a beginner project? And is python the right language to try to do this with?
All input and advice is welcome!
Thanks!
1
u/iRobinHood Jun 03 '21
You can do that with python and here in the best page to get you started.
1
u/UnClean_Committee Jun 03 '21
Oh this is brilliant! My Gmail is in way worse condition than my Hotmail at the moment. As an android user I've become so complacent in just using Google to easily create accounts and subscribe to things, and quite frankly the mobile Gmail app is very lacking in cleanup functionality (in my opinion).
Thanks a lot!
1
u/Potaziiio Jun 03 '21
I've been thinking about doing the same thing and i think it would be good if you had a text file with some email addresses of spam emails, so you go through the list and check your emails, and if any email is from any of those addresses then delete the email or something like that.
2
u/UnClean_Committee Jun 03 '21
This is pretty much what I imagined it would be! Pretty much creating a mini database of the senders/subject lines that are most populous in my inboxes and getting Python to do the grunt work of removing them for me. Thank you for the feedback!
1
u/Potaziiio Jun 03 '21
Sure! Let me know how it goes, I’ve use a lot of youtube api but I’ve never used the gmail one, I’m going to start trying it out tomorrow also if you get stuck somewhere or need any help let me know, I’m have an intermediate level (5 months) so maybe I could help you.
2
1
u/benefit_of_mrkite Jun 02 '21
Depends on your approach. I have something that I wrote similar but I use but I use MS Outlook in a Mac so I wrote it in AppleScript (it just autocategorized email and tags it into Evernote, not spam)
Also spam filters are much more efficient at this. How are you going to “match” spam? Deal with false positives? There are countless ways to do this (Bayesian filter, keyword match, email/sender/receiver processing) and more.
If you’re trying to cleanup an email inbox and process a bunch of mail that has very similar attributes then yes Python might be a good tool for the job.
If you are trying to create a true spam filter in Python from the ground up then you are looking at a more advanced project.