Rotating email into your inbox using imapfilter

By Chris Lamb

UPDATE: You may be interested in my IMAP email toolbox instead.

I'm not a fan of "life hacks", but I have the adopted the following automated processing of my email inbox: if I don't want to deal with a message today, I move it to (eg.) Mail.DELAYED.4 and it will reappear in my inbox automatically in 4 days.

It is inspired by Inbox Zero, tickler files and the Debian DELAYED queue.

My implementation uses imapfilter. You'll need to tweak the move_messages syntax for lenny's version; the following works fine in squeeze and sid:

mbox = IMAP {
    server = '',
    username = 'username',
    password = 'password',
    ssl = 'ssl3'

num = 14
dst = 'INBOX'
prefix = 'Mail.DELAYED.'

for x = 1, num do
    mbox[prefix .. x]:select_all():move_messages(
        mbox[x == 1 and dst or prefix .. (x - 1)]

The messages are moved when I'm (hopefully) asleep:

# m h dom mon dow command
  0 6 *   *   *   imapfilter -c /path/to/delayed.lua >/dev/null

Chris Lamb is a freelance software developer and the current Debian Project Leader. You can read other posts by me, see software I have written or read more about me. You can also follow me @lolamby.

Tags: Hacks GNU/Linux

Planets: WUGLUG UWCS Debian ALUG

Tuesday 4th May 2010