imap_archiver

imap_archiver is a command line tool to archive messages on an imap server. You tell it what folders to archive and where to archive it. For every folder that is archived a series of folders (one for each month) is created inside the archive folder.

Installing

gem install imap_archiver

Configuration

Create a configuration file in ~/.imap_archiver.rb

ImapArchiver::Config.run do |config|
   config.imap_server = 'imap.example.com'
   config.username = 'jellehelsen'
   config.password = "secret"
   config.folders_to_archive = ["Shared Folders/Support" "Shared Folders/Backuplogs" "Shared Folders/Info"]
   config.archive_folder = 'Archive'
   config.base_folder = 'Shared Folders' # part to strip of source folder name to get archive folder name
   config.archive_folder_acl = {'jelle' => 'lrswpcd'}
end

How it works

imap_archiver works by moving messages that are older then 3 months and that have been read and not flagged to a different folder. This helps in cleaning out public folders that get too big to work with.

Consider the following folder structure:

+ Shared Folders
  - Support
  - Backuplogs
  - Info

Given the configuration above, this would be archive as such:

+ Archive
  - Support
    - Mar 2010
    - Apr 2010
    - ...
  - Backuplogs
    - Mar 2010
    - Apr 2010
    - ...

Known bugs

The documentation is sparse to non-existing. It has only been tested against my own cyrus-imap server and a dovecot test server. For all unknown bugs: file an issue report! Creating a patch yourself helps in getting it fixed quickly.

TODO

  • Make the archive period configurable

  • Make the archive folder name configurable

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 Jelle Helsen. See LICENSE for details.