☠ Takes care of overfull IMAP boxes.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
maze cef42dde26 Use dedicated channel for expunges 2 years ago
.gitignore Initial commit 2 years ago
LICENSE Initial commit 2 years ago
Makefile Added -archive feature 2 years ago
README.md Docfix 2 years ago
main.go Use dedicated channel for expunges 2 years ago

README.md

imapreaper

Takes care of overfull IMAP boxes.

(?_^,
 |\ )  I am the IMAP reaper
 |/_\

Installing

On debian, it’s easiest to use godeb, on MacOS you can install go from Homebrew.

After setting up go, make sure $GOPATH is set to a convenient location.

~% export GOPATH=$HOME/gopath
~% go get git.maze.io/maze/imapreaper
~% cd $GOPATH/src/git.maze.io/maze/imapreaper
imapreaper% make clean build
...
imapreaper% sudo make install

See imapreaper -help for an overview of all supported options.

Security

imapreaper can take a -password argument, which is very dangerous and insecure as it will show your plain text password in the system process list.

In stead, use one of the supported keychain solutions, such as MacOS KeyChain, SecretService or gnome-keyring.

Duration formats.

A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are:

s  (for seconds)
m  (for minutes)
h  (for hours)
d  (for 24-hour days)
w  (for one week of 24-hour days)

Smaller units are available but omitted for brevity.

Example

~% imapreaper -server <redacted>:993 -username <redacted> -archive "30d=lists.*;90d=team.*" -delete "30d=systems.*"
2016/10/21 16:57:51 starting
  (?_^,
   |\ )  imapreaper v1.1-0-g9b1a84f
   |/_\
2016/10/21 16:57:51 matcher: folders matching "INBOX.systems.*" for 720h0m0s
2016/10/21 16:57:51 matcher: folders matching "INBOX.lists.*" for 720h0m0s
2016/10/21 16:57:51 matcher: folders matching "INBOX.team.*" for 2160h0m0s
2016/10/21 16:57:51 connected to <redacted> as <redacted>
2016/10/21 16:57:51 processing INBOX.systems.alarms
2016/10/21 16:57:52 ... deleting all before 2016-09-21 16:57:51.880714292 +0200 CEST (searching in 307 messages)
2016/10/21 16:58:00 ... matched 139
2016/10/21 16:58:00 processing INBOX.systems.packages
2016/10/21 16:58:00 ... deleting all before 2016-09-21 16:57:51.880714292 +0200 CEST (searching in 697 messages)
2016/10/21 16:58:13 ... matched 266
2016/10/21 16:58:13 processing INBOX.lists.infra
2016/10/21 16:58:13 ... archiving all before 2016-09-21 16:57:51.880714292 +0200 CEST (searching in 0 messages)
2016/10/21 16:58:13 ... nothing to do
2016/10/21 16:58:14 processing INBOX.team.sales
2016/10/21 16:58:14 ... archiving all before 2016-07-23 16:57:51.880714292 +0200 CEST (searching in 13514 messages)
2016/10/21 17:01:02 ... matched 12953
2016/10/21 17:01:02 archive folder INBOX.archive.2012.team.sales does not exist
2016/10/21 17:01:02 archive folder INBOX.archive.2013.team.sales does not exist
2016/10/21 17:01:03 archive folder INBOX.archive.2014.team.sales does not exist
2016/10/21 17:01:04 archive folder INBOX.archive.2015.team.sales does not exist
2016/10/21 17:01:04 archive folder INBOX.archive.2016.team.sales does not exist
2016/10/21 17:01:08 creating 5 folders and trying again
2016/10/21 17:01:08 creating folder INBOX.archive.2012.team.sales
2016/10/21 17:01:08 creating folder INBOX.archive.2013.team.sales
2016/10/21 17:01:08 creating folder INBOX.archive.2014.team.sales
2016/10/21 17:01:08 creating folder INBOX.archive.2015.team.sales
2016/10/21 17:01:08 creating folder INBOX.archive.2016.team.sales
2016/10/21 17:01:08 ... archiving all before 2016-07-23 16:57:51.880714292 +0200 CEST (searching in 13514 messages)
2016/10/21 17:01:08 ... matched 12953
2016/10/21 17:01:09 ... copying 727 messages to INBOX.archive.2012.team.sales
2016/10/21 17:01:44 ... copying 2918 messages to INBOX.archive.2013.team.sales
2016/10/21 17:04:44 ... copying 5776 messages to INBOX.archive.2014.team.sales
2016/10/21 17:04:57 ... copying 2513 messages to INBOX.archive.2015.team.sales
2016/10/21 17:05:32 processing INBOX.systems.cron
2016/10/21 17:05:32 ... deleting all before 2016-09-21 17:11:31.335415507 +0200 CEST (searching in 410 messages)
2016/10/21 17:05:32 ... matched 410
2016/10/21 17:05:38 processing INBOX.systems.backup
2016/10/21 17:05:38 ... deleting all before 2016-09-21 17:11:31.335415507 +0200 CEST (searching in 0 messages)
2016/10/21 17:05:38 ... nothing to do

Speed

The speed of the reaping operations all depend on the speed of your IMAP server. imapreaper tries to use batch operations (as supported by the IMAP protocol) where possible to limit the amount of operations required.