Automating Gmail
One of Gmail’s hidden treasures is how easily it can be automated. Its filtering system is widely known, but the real treat is script.google.com, which lets you script Gmail. The scripts are written in a language called “Google Apps Script” (which is more or less JavaScript), and there is a wide-ranging API that lets you control almost all of your Google services (Drive, Analytics, Calendar, etc). These tasks can be run periodically, in response to triggers, or ad-hoc.
An example: automatically mark emails as read
If your inbox has thousands of unread emails that are unlikely ever to be read, and you are anxious about this, you might benefit from automatically managing your unread email count. I’ve created a script which, on weekdays, marks as read any unread email older than 24 hours. This lets me skim the subject lines in my inbox, open the emails that seem interesting, and ignore the rest, which will quietly vanish a day later.
Combined with Priority Inbox, this script helps me have a high ratio of “effectiveness at email” to “attention spent on email”, which I lack if I have to read every single message in my inbox. Despite how risky this approach seems, it hasn’t caused me to miss out on anything important.
You can see my “Mark All As Read” script here.
Development
Scripting Gmail is very approachable. The API covers lots of functionality, and the documentation is comprehensive. You don’t need an in-depth knowledge of JavaScript. Google even provides a little web-based IDE in which to edit and debug your scripts. My one complaint is that there is no mock environment for testing - you have to develop your scripts on a real inbox. If this is a problem for you, you can use a dummy email account for development.
In conclusion
In the future, I’d be interested to try script.google.com to automate my use of other Google services. For now, it’s proven extremely useful at managing my email, and I strongly recommend it.