Mailbox format conversion plugin
================================

This plugin can be used to convert mails from one format to another when the
user logs in. The existing mails aren't deleted, only the directory is renamed.

For example:

---%<-------------------------------------------------------------------------
mail_location = maildir:~/Maildir
protocol imap {
  mail_plugins = convert
}
protocol pop3 {
  mail_plugins = convert
}
plugin {
  convert_mail = mbox:~/mail:INBOX=/var/mail/%u
}
---%<-------------------------------------------------------------------------

This converts '/var/mail/user' INBOX to Maildir INBOX in '~/Maildir'. Also all
mailboxes in '~/mail/' are converted to Maildir mailboxes. Once everything is
finished,'~/mail' is renamed to '~/mail-converted' and at next login the
conversion isn't done, because the '~/mail' directory no longer exists.

UW-IMAP conversion
------------------

If your mailboxes exist in home directory among other files, you'll need to
use:

---%<-------------------------------------------------------------------------
plugin {
  convert_mail = mbox:~/:INBOX=/var/mail/%u
  convert_skip_broken_mailboxes=yes
}
---%<-------------------------------------------------------------------------

Otherwise the conversion stops at the first file which isn't an mbox.

UW-IMAP notes from Andrew Z
---------------------------

mbox:/home/%u seems to work better than mbox:~/ . Then, my Dovecot 1.0.1 fails
converting mboxes from ~, but it works after moving mboxes to ~/mail.   Also, I
was able to preserve subscriptions (to prevent manual re-subscriptions) by
copying ~/.mailboxlist to ~/Maildir/subscriptions (before first IMAP login). 
Don't forget the user must own the mail files in his directory.

Also it's worth to check if mbox directories do not contain files and folders
with names starting with '.', like .spamassassin and .profile. With such files
or folders convert plugin will fail, complaining about illegal names, and you
will get .imap subfolder in mbox folders, thus increasing the problems.

To automate moving mailboxes and preserving subscriptions, see this script:
http://www.dovecot.org/list/dovecot/2007-June/023757.html More accurate version
of this script http://textsnippets.com/posts/show/1410 

(This file was created from the wiki on 2009-02-04 04:42)
