using mh-e under GTD

8 minute read

Introduction

One thing you need to get to grips with when using GTD is the

  • Collect,
  • Process,
  • Organise,
  • Review,
  • Do

cycle.

This article focuses on how mh fits into this part of the equation for me with the email part of my GTD. I use org-mode (another emacs mode) for maintaining my lists, and find mh-e and org-mode work quite nicely together.

I’m assuming that if you are using MH and mh-e under linux/unix etc, you need no introduction to shell scripting, cronjobs etc.

Principles

When I go through my inbox in the morning I usually have around 60-80 emails which have collected overnight. These are a mixture of system messages from our servers, a small number of low volume mailing lists which I want to see daily (mh-e, org-mode, linux-thinkpad), and the rest are emails from people I work with (from the same organisation, from other organisations within the NHS, or from our commercial customers).

Using the two minute rule, I deal with each email using one of the following options:

  1. read and delete;
  2. read and file (no further action required, but want to keep for reference);
  3. read and reply (if can do in less than 2 minutes), followed by delete, file (for reference) or file for followup (see later);
  4. file into @today folder for emails which I need to deal with but will take more than 2 minutes. When I have finished going through my inbox, the @today folder is usually the next one I look at as I know there are emails there which need dealing with;
  5. file into +pending/tonight - usually personal emails I want to get out of my way so I can deal with them at home in the evening.
  6. file into one of my pending folders - these are for emails which:

    a. I can’t do anything about now (for example, I need to be in the lab to deal with, and won’t be there for a few days);

    b. are time dependent (agenda for a meeting, which I want to come back to me the day before the meeting);

    c. I want to cogitate about (a difficult email I want to think about for a few days before replying)

    d. I’m waiting for a response on - for example, if I send an email asking somebody to do something, I either put a note into my lists for that person, so I can check the progress when I next see them, or I may think that I would like to see that email again in a months time back in my inbox.

Some ‘time management’ methodologies say that you should only handle each piece of paper (or email) only once. However, I have no problems with seeing emails (or pieces of paper in fact) multiple times - it is no different from reviewing your lists on a weekly basis in my opinion. I know that sometimes I will be smarter in a few weeks or even a few months time, and want emails to be automatically picked up from their pending location and popped back into my +inbox at that stage. Therefore I set them to ‘incubate’ in one of my pending folders, knowing that they will be brought to my attention at a time of my choosing.

So with the principles out of the way, here is how I do this.

Setting up your folders

The following commands will set up your basic set of folders for you:

folder -create +@today
folder -create +pending
folder -create +nextweek
folder -create +tonight
folder -create +tomorrow

for (( f = 0; f < 32; f += 1 )); do
folder -create +pending/d$f
done

for i in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
do
folder -create +pending/$i
done


for i in Sunday Monday Tuesday Wednesday Thursday Friday Saturday
do
folder -create +pending/$i
done

The crontabs

Using crontabs is the key to making all of this work.

This is my crontab:

# m h  dom mon dow   command
# minute (0-59) hour (0-23) day of month (1-31) month (1-12)  day of week 0-7 (0 or 7 is Sun)
PATH=/bin:/usr/bin:/usr/bin/mh
HOME=/home/pete
# run this every saturday morning at 1:10 am
# see http://rand-mh.sourceforge.net/book/mh/e-rmmer.html
10 01 * * 6 /usr/bin/find /home/pete/Mail/DELETE -mtime +10 | /usr/bin/xargs /bin/rm
#############################################################
#  Mail Section
#############################################################
### Each month, refile all the pending stuff back to my inbox.
### 1:10 on the first day of each month
10 4 1  * * $HOME/bin/monthly-pending
### Each monday refile all the next-week stuff
15 4 *  * 1 $HOME/bin/weekly-pending
### Each day also has its own pending - Saturday, Sunday etc
20 4 *  * * $HOME/bin/day-of-week-pending
### Each date of the month (1-31)  also has its own pending - d1, d11, d31 etc
25 4 *  * * $HOME/bin/day-pending
### Each night at 17:30 - refile all pending/tonight to inbox
30 17 *  * * $HOME/bin/tonight-pending
### Each night at 12:30 - refile all +today stuff back to +inbox
40 01 *  * * $HOME/bin/today-refile-to-inbox
# Each day refile the tomorrow pending back to +inbox
35 4 *  * * $HOME/bin/tomorrow-pending
#############################################################
# email reminders about checking the various daily files
# (physical, not email folders) I need to check - the 31 folders.
#############################################################
35 6 * * * /bin/echo "Check your black folder - stuff for lab." | /usr/bin/nail -s "check black folder - stuff for work ?  stuff to file ? receipts for office etc ?" pete@smtl.co.uk
35 6 * * * /bin/echo "Check your daily files." | /usr/bin/nail -s "check daily files" pete@smtl.co.uk
# index mail every hour. YMMV!
30 * * * * /usr/bin/mairix -f /home/pete/Mail/.mairix/config 2>/dev/null

Note that I also use the rmmer scripts so that when I delete emails, they are actually moved to +DELETE, and only deleted from there when they are 10 days old by one of the cron jobs.

The shell scripts

These are very short shell scripts. You could probably stick them directly into your crontab if you preferred.

monthly-pending

#!/bin/sh
# shell script to be run monthly which will take all pending stuf
# from this months folder and stuff into inbox
refile -src +pending/`date +%b` all  +inbox

weekly-pending

#!/bin/sh
# shell script to be run monthly which will take all pending stuf
# from this months folder and stuff into inbox
/usr/bin/mh/refile  -src +pending/nextweek all  +inbox

day-of-week-pending

#!/bin/sh
# shell script to be run monthly which will take all pending stuf
# from this day's folder and stuff into inbox
refile -src +pending/`date +%A` all  +inbox

day-pending

#!/bin/sh
# shell script to be run daily which will take all pending stuf
# from this day's folder and stuff into inbox
# these mailboxes are labelled +pending/d1 - +pending/d31
refile -src +pending/d`date +%-d` all  +inbox

tonight-pending

#!/bin/sh
# shell script to be run daily which will take all pending stuf
# from this folder and stuff into inbox
/usr/bin/mh/refile  -src +pending/tonight all  +inbox

today-refile-to-inbox

#!/bin/sh
# shell script to be run daily which will take all emails from the today
# folder and stuff into inbox
/usr/bin/mh/refile  -src +@today all  +inbox

tomorrow-pending

#!/bin/sh
# shell script to be run daily which will take all pending stuf
# from this folder and stuff into inbox
/usr/bin/mh/refile  -src +pending/tomorrow all  +inbox

How does it all work ?

So every day, I process my emails. I deal with emails in +@today later in the day, but if I don’t get to them (something else comes up which takes priority), they all get filed back into my +inbox during the night. This is because the next day my priorities will have changed so an email I thought I should deal with may now be one I need to delete.

If I file an email now (April) into +pending/November, then on the 1st November, the crontab will refile it back into +inbox.

This is the same for all of the pending files - emails will stay in the apporpriate folder until the crontab picks it up at the appropriate time and dumps it back into +inbox.

If you have read GTD, you will probably recognise this as the 42 folders principle - each day you open the day folder and dump it into your in-tray, and each month you dump the contents of that into your in-tray and then process.

Other folders

These are my other top level folders:

+Contacts

In here I will have folders for anybody I receive emails from

+Contacts/bill.wohler
+Contacts/carsten.dominik
+Contacts/joe.smith

I have around 1,400 folders in here

‘+OUT_MAIL’

I have a custom header added to my emails in my components and repl.comps files etc, so that every single email I send has the following header:

Dcc: pete@smtl.co.uk

See for details.

This makes our mail server send the email back to myself, where procmail can pick it up and file it according to a set of rules. The most basic one is:

MONTH=`/bin/date +%b`
YEAR=yr`/bin/date +%Y`
RCVSTORE=/usr/lib/mh/rcvstore             # rcvstore location

:0
* (^Received: from lap1.smtl.co.uk.*)
{

:0
* (^To:.*jim.smith@domain.net.*)
| $RCVSTORE +Contacts/jim.smith

[other rules go here]

# Otherwise, stick in OUTMAIL, filed by month/year ...

:0 E
* .*
| ${RCVSTORE} +OUT_MAIL/$YEAR/$MONTH
}

which checks if it is an email I sent from my laptop, and if so assumes I have routed it back through procmail so it can be filed. After going through rules which automatically file emails into person specific folders, anything else just gets filed in an outbox by year and month.

Note that you will have to check whether your MTA supports the Dcc header. We use postfix, which is OK, and previously used sendmail, which also supported this.

Mailing Lists

I belong to around a dozen mailing lists, some of which are high volume. I don’t have these funneled into my +inbox - using sieve, they go into list-specific folders on our imap server, and I scan them around once a month. I would recommend that unless you belong to mailing lists which are mission critical to your work or projects, do not have them delivered to your +inbox, as it makes the processing phase take way too long. You want to be able to process your +inbox in 30-60 minutes if you can.

Author: Pete Phillips pete@smtl.co.uk $Revision: 1.2 $ Date: 2008/04/20 16:00:18

Leave a Comment