Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
I've just taken a quick look at the gmail api and started to code up a small application to scan through a gmail account and identify all messages over a certain size. There is no facility to do this within the gmail interface, in spite of this being one of the easiest ways to keep your mailbox from filling up with junk.
At the moment I've just got it to 'star' each of the matching messages, so they can be manually reviewed for deletion. I have a few ideas for making it better, and I reckon that a lot of people would like to use such a program. Before I put in much effort, I thought it worth getting some feedback, first to make sure others thought it would indeed be useful, and secondly to make sure that no similar tool already exists.
So please give feedback. A few ideas I've had off the top of my head are:
- make a GUI to review the messages directly, without needing to label them for future review.
- only check messages older than a certain interval (e.g. 3 months)
- allow some sort of sliding scale, so that the older a message is, the lower the threshold is. ie: a 1-month old 10Mb message might be flagged for review, but a 1-year-old 1Mb file might also fit the criterion.
- (somehow) remember which messages have already been scanned, to speed up future executions
- also calculate "total message size by sender". For example, your friend might send 100Kb emails of jokes every few days. Each email is below the radar, but together they might suck up a lot of your quota.
Instead of using setting messages to starred, set them to a label, like "Large Messages". Most people use stars for other purposes.
In the last 10 minutes (prior to your reply) I did just that.
In fact, you can configure a number of thresholds (in Mb), and matching emails will be labelled accordingly. The labels will be generated on demand.
e.g. a 3Mb email would have the "larger than 1Mb" label applied, but not the "larger than 5Mb" one.
I've made some more changes too - one of them being to only process a month's worth of email each time it's run. Why? Well, while testing this application yesterday I was locked out of my account, presumably for reading too many messages in a short period of time. So the first time it's run it might check January 2004, next time February 2004, etc. When it's checked up until a couple of months ago it won't do anything further, so it'd be safe to put it in a cronjob and forget about it.
I'm in two minds about whether to compile up a version for windows people. For now I'll stick with running/testing it under linux, and see what bugs/features come up. Right now it doesn't have a GUI, nor need one - just throw a few settings into a configuration file and check the log file occassionally.
I've also modified libgmail a little: I've added a few new methods (createLabel, setLabel, starMessage) and an attribute to the message object (attachmentsize). There's nothing contentious there (IMHO) so I'll probably submit the patch once I'm sure I don't need any other methods.