= IMAPCleanse
Rubyforge Project:
http://rubyforge.org/projects/seattlerb/
Documentation:
http://seattlerb.rubyforge.org/IMAPCleanse/
== About
IMAPCleanse removes old, read, unflagged messages from your IMAP
mailboxes.
== Why?
I’m lazy. I don’t delete read messages from my mailboxes because I
like to
have context when reading threads. Since I’m lazy my more-trafficed
mailboxes
can end up with tens of thousands of read messages. Deleting this many
messages with Mail.app is time consuming and boring.
So I wrote IMAPCleanse to clean out my old mailboxes for me. If I
want to keep
a message around for forever I’ll just flag it and IMAPCleanse won’t
touch it.
== Installing IMAPCleanse
Just install the gem:
$ sudo gem install IMAPCleanse
== Using IMAPCleanse
In short:
imap_cleanse -H mail.example.com -p mypassword -b Lists/FreeBSD/
current,Lists/Ruby -a 30
The help for IMAPCleanse should be sufficiently verbose, but here’s a
couple of
tips:
=== --noop and --verbose
The --noop flag tells IMAPCleanse not to delete anything. When
combined with
the --verbose flag you can see how many messages IMAPCleanse would
have deleted
from which mailboxes.
$ ruby -Ilib bin/imap_cleanse -nv
Connected to mail.example.com:993
Logged in as drbrain
Cleansing read, unflagged messages older than 26-Feb-2006 17:04 PST
Found 23 mailboxes to cleanse:
mail/Lists/FreeBSD/current
[…]
mail/Lists/Ruby/ZineBoard
Selected mail/Lists/FreeBSD/current
Scanning for messages
Found 0 messages
[…]
Selected mail/Lists/Ruby/ZineBoard
Scanning for messages
Found 0 messages
Done. Found 0 messages in 23 mailboxes
(Since I just ran IMAPCleanse it didn’t have anything to do.)
=== ~/.imap_cleanse
The ~/.imap_cleanse file can hold your password and other options so
you don’t
have to type them in on the command line every time. The format is
simple,
just the options file name followed by ‘=’ followed by the argument.
No whitespace is stripped from options, so be sure to do that
yourself. Mine
looks something like this:
Host=mail.example.com
SSL=true
Username=drbrain
Boxes=Lists/FreeBSD/current,Lists/FreeBSD/performance,Lists/
FreeBSD/Soekris,Lists/FreeBSD/stable,Lists/Ruby
Age=30
Password=my password
–
Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant