Dovecot Snooze

This is a script to go through dovecot mailboxes and snooze mails until a given time. Works like this: You need to have a predefined set of folders (see below how to subscribe your user to those folders), and this script will go through the folders every minute (so you have to set up a cron-job) and put an IMAP label on them. The label will be called something like "MoveAt123456789" where the number is the timestamp when the mail should be moved back into the users inbox.

So when you drag a mail into one of these folders it will stay there until the MoveAt Timestamp has been reached, and then the script will remove the IMAP label and move the mail back into the user's inbox and mark it as new.

Run the script from cron like this:

./ user1 user2 user3

Add -h for more help.

Example /etc/crontab entry:

* * * * *   root  /usr/local/sbin/ maryjane

By the way, we assume that the separator of your Snooze folder and the subfolder is a dot, not a slash. Unfortunately you can't change that currently. Send me a patch to fix this!

to subscribe a new user:

$ user=maryjane
doveadm mailbox create -s -u $user 'Snooze'
doveadm mailbox create -s -u $user 'Snooze.Until Friday 18:00'
doveadm mailbox create -s -u $user 'Snooze.Until Monday 7:00'
doveadm mailbox create -s -u $user 'Snooze.Until 7:00'
doveadm mailbox create -s -u $user 'Snooze.Until 18:00'
doveadm mailbox create -s -u $user 'Snooze.For 1 Hour'

Get the sourcode on github

Last Update: 2015