Converting from UNIX mbox/mailbox to Maildir
This guide discusses transforming a system from the traditional mbox/mailbox format to the more advanced Maildir format.
I assume you are using the postfix mailer - if not, you will probably want to change over to postfix first or some of this material may not be relevant.
Make a backup
Before commencing, backup your entire system.
Stop the mailer
You do not want any mail coming in while doing the conversion. You should also stop any programs that automatically generate mail locally.
# /etc/init.d/postfix stop
Get the necessary tools
If you are running Debian, this command will get everything you need:
# apt-get install mb2md
Convert each users mail
For each user on your system:
# su daniel
$ cd ~
$ mb2md -m
$ mb2md -s mail
# mv /var/spool/mail/daniel /var/spool/mail/daniel.preMaildir
# mv ~daniel/mail ~daniel/mail.preMaildir
NOTE: The second
command is only needed if the user has a directory
Later on, you will want to delete the
.preMaildir versions to recover disk space. Before you do so, make sure everything is working fine.
If you are using the built in delivery agent you should put this into
home_mailbox = Maildir/
If you are using procmail as your delivery agent, you should put this into
/etc/postfix/main.cf (it is all one line):
mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=$HOME/Maildir/ MAILDIR=$HOME/Maildir
If you are using another delivery method, you should refer to the documentation that comes with it.
If you are using LDAP, you may need to put an attribute into each user's entry in the directory. The attribute needs to specify the full path of the Maildir, with a trailling /
If users have their own
.procmailrc files, then they need to be updated. This could be time consuming.
Wherever a folder name is specified, such as
/home/daniel/mail/folder1, it needs to be changed to
.folder1/ - you don't need to put the complete filesystem path, just the full stop, a folder name and a trailling slash.
changed for Maildirs:
Remove uw-imap, install cyrus-imap
If you are using uw-imap to access your mail, you will need to find a new IMAP server. Try cyrus-imap. On Debian, just type:
# apt-get install cyrus-imap
If you use squirrelmail, you need to make the following changes:
Section (2) "Server Settings", change the IMAP server type to "Cyrus" and make sure that "delimiter" is set to "detect".
Section (3) "Folder Settings", make sure the first option, "Default Folder Prefix" is blank.
You will also need to change the prefs file for each individual user (I hope you know how to use sed, or you could be editing a lot of text files by hand!).
daniel, the file to change is
You simply need to make sure these values are correct, this is what I use for compatibility with my other IMAP client, Mozilla Thunderbird (package icedove on Debian):
Don't forget this last step, or you won't receive any mail for a few days.
# /etc/init.d/postfix start