Email still is, and will remain for a while, THE standard for many forms of non-real-time, online communications. Even if it has big issues like spam and no built-in security, we are all sure we can exchange email with anybody with any computer, tablet, or smartphone, worldwide.
One obvious downside of its ubiquity is that (even ignoring spam) email floods our Inboxes. Search “email overload” online, and you’ll find plenty of complaints about people “spending a quarter of their day on email-related tasks”, or because the average response time to email would have grown 13% in 2012.
In my experience, which I believe to be a very common one, the real problem is not the mere number of messages arriving every day, even when it is really high. The two top productivity killers in email are:
- painfully long, but totally uninteresting threads that keep coming because they are from a mailing list, or you were included among the initial recipients by mistake but everybody continues to “Reply To All”
- messages appearing every few minutes, forever. It’s incredible how those continuous “unread messages” notifications can destroy concentration while you’re dealing with really urgent email, isn’t it?
Before you say it: yes, I do know that there are web-based email services that make a good job of solving both the problems above, but I wanted something different. I wanted a way to solve them with Free Software by myself, on computers and accounts that are entirely under my control.
I solved the first problem thanks to an email filter that Procmail guru Sean Straw was so kind to write for me. That recipe automatically discards all the replies, and replies to replies, etc. to any email message that I “save” in a special mailbox. To know how you can do the same on your Linux system, read this old post of mine on how to ignore uninteresting threads in mailing lists.
The second problem, that is, the constant distraction caused by new email appearing in the Inbox(es) every few minutes, is even simpler to solve, once you frame it in the right way.
Mailing lists have a Digest mode in which subscribers only get one email per day, containing all the messages in the previous 24 hours. In practice, not only digests are almost useless to prevent constant distraction, but also create other problems. First, the procmail recipe mentioned above can’t discard uninteresting threads, if they are lumped into digests (not without a lot of extra, unneeded work anyway). Secondly, you can’t control when digests arrive. Above all, digests only exist for mailing lists. Can you ask all your customers, coworkers, friends and relatives, not to mention automatic newsletters, to please send you email only between 1 and 2 pm?
Of course, you can’t. So how can you be sure to see non mission-critical email appear in your Inbox only during lunch break, or whatever moment is less disturbing? The solution is quite easy, if your mailboxes are in Maildir format, on a computer (preferably, but not necessarily a Linux one) on which you can run Shell scripts. This will allow you to time-shift your email processing and filtering.
Here is what I mean: a Maildir mailbox is a standard directory with three sub-directories: new stores unread messages, cur the ones you already read, and tmp is an auxiliary folder, not relevant for the topic of this post. Every email (with all its attachments) is stored as one separate file.
What do we get when a mailbox is just a normal folder and an email is just a normal file? Well, nothing less but the possibility to move email from mailbox to mailbox with simple shell scripts, including ones that run automatically, as cron jobs, when we choose. That’s what I mean by time-shifted email processing!
For simplicity, I’ll only describe the simplest possible case, which you may adapt as you please. Let’s assume that your current filters save all email that you do want to read, as soon as it arrives, in one Maildir mailbox, called NEWMAIL. Change those filters to move all messages but those that really, really can’t wait (e.g. those from mom!) to another/, auxiliary Maildir called WAITING. Next, prepare a shell script similar to this one:
1 #! /bin/bash
2 for MDIR in new cur
4 for FILE in $(find WAITING/$MDIR -type f | grep -v dovecot )
6 mv $FILE NEWMAIL/$MDIR/
The code above finds all the files (that is, email messages!) in the new and cur subfolders of the WAITING mailbox, and moves them to the corresponding subfolder in NEWMAIL. Special files placed in Maildir by some IMAP servers should not be moved. That’s the reason for the “grep -v dovecot” part of line 4: IMAP servers other than dovecot would need different filtering.
Set cron to run this script daily at 6pm, and you will see new, non-urgent messages in your Inbox only once a day: all together, at 6pm, regardless of when they actually arrived (messages from mom and similar will not be delayed, see above). If once a day is too much, run the script every 6 hours, or whatever interval is best for you. Filling your Inbox with bursts of tens of messages may seem counterproductive, but it isn’t: trashing all the irrelevant email and reading what’s left in one fell swoop, only once a day, will save you lots of time. Especially if you were also running the “uninteresting threads” filter!