2009/06/15

One mbox to hold 'em all

Roll your own IMAP mailbox into gmail:
  1. git clone git://github.com/rgrove/larch.git
  2. git clone git://gitorious.org/trollop/mainline.git
  3. emerge -av highline
The larch Copy all folders recursively option gave me some problems, and since I wanted to do some mapping of folder names to different labels on gmail:
  1. Make a list of folders on the from server - I used the contents of my thunderbird directory. E.g. something like:
    find . -name '*.msf' | sed -e 's/.msf//' -e's/.sbd//g' -e 's/-1//' -e 's/.\///'|sort|uniq
  2. xemacs above to create a file, with one line for each folder with a simple format: from_format to_label
  3. Feed into a script something like:
while read from to ; do
ruby -Imainline/lib:larch/lib \
larch/bin/larch \
--from imap://imap.example.foo --from-user XYZ --from-pass OPW \
--to imaps://imap.gmail.com --to-user ABC --to-pass DEF \
--from-folder $from --to-folder $to
done