Converting Mbox mailboxes to Maildir format

From PeTechWiki
Jump to navigationJump to search

Overview

Maildir is a structure for directories of incoming mail messages that solves the reliability problems that plague mbox files. A directory in maildir format has three subdirectories, all on the same filesystem: tmp, new, and cur.

Each file in new is a newly delivered mail message. Files in cur are just like files in new. The big difference is that files in cur are no longer new mail: they have been seen by the user's mail-reading program. The tmp directory is used to ensure reliable delivery. For a new user who does not have existing mail messages in mbox format, all that is required is to create the ~/Maildir directory and its tmp, new, and cur subdirectories all owned by the user.

The mb2md conversion script

For an existing user who has existing mail messages in mbox format, the mb2md script is useful for converting the existing messages to maildir format.

Download

Download from http://www.akadia.com. Version: mb2md-3.10 (requires TimeDate!)

Installation

Extract the mb2md script and copy it to the file mb2md somewhere in your path. Set the mb2md file permissions +x.

To install the TimeDate perl library, extract the files from the archive to a temporary location. Change the current directory to the extracted folder and run the following commands:

perl Makefile.PL
make
make test
make install

Example Usage

For detailed usage and examples, see the comments at the beginning of the mb2md script. For usage summary type mb2md -h.

We have a bunch of directories of Mbox mailboxes located at: /home/blah/oldmail/. We also have the mailspool Inbox at: /var/spool/mail/blah.

To convert these, as user blah, we give the first command:

mb2md -m

The main Maildir directory will be created if it does not exist. (This is true of any argument options, not just "-m".)

/home/blah/Maildir/

It has the following subdirectories:

/home/blah/Maildir/tmp/
/home/blah/Maildir/new/
/home/blah/Maildir/cur/

Then /var/spool/blah file is read, split into individual files and written into /home/blah/Maildir/new/.

Now we give the second command:

mb2md  -s oldmail -R

This reads recursively all Mbox mailboxes and writes folders and files in Maildir format into /home/blah/Maildir.

Reference: Converting Mbox mailboxes to Maildir format

Configuring mail servers for Maildir delivery

Configuring procmail

Configuring sendmail

Configuring postfix

Configuring dovecot