Command-line afficionados like me have fallen out of fashion. We’re as anachronistic as bottom-posting. No doubt the ubiquity of mobile interfaces has persuaded most people, even programmers, to turn away from the keyboard and toward the screen. Few of the young coders I meet, people who spend lots of time in editors or IDEs, seriously consider using such a crude old-school email reader as Mutt. After all, who wants to type at the command line when you can swipe, spread, pinch, and click instead?
Gesture interfaces offer some amazing capabilities. Yet some of my essential daily tasks, like working through email, are much faster with a keyboard-driven approach. Google even concedes as much with its keyboard shortcuts for Gmail.
Mutt is not a great email client. It has a clunky interface. Getting configuration into a usable state taxes one’s patience. It has limitations that you probably need to peruse source code to understand.(Anyone out there making non-trivial use of alternates that doesn’t break group reply?) Yet despite all of these shortcomings, I use it, even with Gmail.
Search the web for tutorials for configuring Mutt with Gmail and you’ll find plenty for your use case. My use case is accessing Gmail directly via imap. I have a separate configuration file for each of several accounts. I have a separate configuration file for each account, and run a separate instance of Mutt for each. And I use goobook for address completion.
Once you get gmail set up, you’ll immediate encounter a problem that I have not seen addressed in any of the tutorials. You have a lot of mail, and loading your archive or all of your mail takes a very long time. Caching message headers locally improves performance, but falls far short of tolerable performance.
If your email patterns are like mine, my searches make almost exclusive use of threads with recent correspondence. Why load all of your history just to look in the last week’s threads? But Mutt has no mechanism to use the full query language in Gmail and search by date ranges. Labels that correspond to recency buckets would work, but Gmail offers no apparent way to automatically update those. Enter Google Apps Script.
A script attached to a Google Spreadsheet does allow automatic updates to labels. You can find an example here. Make a copy of this spreadsheet (you need edit permissions to run the scripts). You should see a menu item that lets you authorize and configure the script. It runs every half hour and applies a label from the spreadsheet to messages matching the corresponding filter. View and edit the script through the Tools menu.
Add Gmail filters to apply any appropriate labels to new messages as they arrive and you have a system that keeps labels up to date. Now when you read your email in Mutt you can load the last7days label instead of all mail, and stop waiting for all of that history to load.
Try it and let me know in the comments how well it works for you.
Posted by William Baxter on Jan 3, 2016