I’ve been wanting to do this for a while, but too busy, too bone idle and finally too agonize that I force lose my mail archive…. etc…etc…etc..
Over last weekend, I bit the bullet and did it. To some extent because my DSL line was down, so there was no network activities, no mail, so force as well take advantage of the down time. My next machinate is to drop AT&T DSL, I am tired of their bs.
Not meaning to get off the subject, but I am one of the original DSL sub in the neighborhood. Got mine in ’96 (only 768k down/256K up). I am about ~14-15000 ft from nearest CO, limit of DSL line. Back then, Pacbell promised they will upgrade facility in the area so I can get quicker speed. Quick forward to 2009, 14 years later, still same ancient… and still crappy service.
Ok, back to converting from mbox+procmail+dovecot to maildir+deliver+dovecot+sieve. My mail archive goes back a long way, still have emails from 1987 (UUCP/Usenet mail). I’ve always used mbox format, as that was the defaulting then, and since I never used qmail….
I do separate my mail into folders (just another mbox file) of course, otherwise my main mailbox would be in the gigabyte range. I use procmail to filter incoming email into these separate boxes, to automate dealing with requests, to bounce spam, etc. My .procmailrc is around 30K in size with lots of recipes, and also pulling in dozens of include files.
I knew that mbox is inefficient and that procmail is killing my system I/O, but sheer inertia kept me where I am.
After some investigate, I found mb2md.pl — a Perl speech — that will do most of the rumble work in converting an mbox file into maildir. I am by Postfix for my MTA and dovecot for IMAP, so support for maildir is already there. Supposedly, procmail supports maildir, but…
Here is the basic HOW-TO for converting mbox to maildir.
Basics: I am by Postfix, dovecot on FC11
1. Stop postfix and dovecot.
2. Install dovecot-sieve (and dovecot-managesieve if you have users beside yourself)
3. Edit /etc/postfix/main.cf and exchange mailbox_command to /usr/libexec/dovecot/deliver
mailbox_command = /usr/libexec/dovecot/deliver -a “$RECIPIENT”
The -a “$RECIPIENT” part is if you want to use user+foo@domain.com
4. Edit /etc/dovecot.conf
- look for protocol lda { section and make sure this is there, add/uncomment/edit if not
- # Support for dynamically loadable plugins. mail_plugins is a space separated
# list of plugins to load.
mail_plugins = sieve
mail_plugin_dir = /usr/lib/dovecot/lda
- look for plugin { section and look for these lines:
- # Sieve plugin (http://wiki.dovecot.org/LDA/Sieve) and ManageSieve service
#
# Location of the active speech. When ManageSieve is used this is really
# a symlink pointing to the active speech in the sieve storage space directory.
sieve=~/.dovecot.sieve
#
# The path to the directory where the personal Sieve scripts are stored. For
# ManageSieve this is where the uploaded scripts are stored.
sieve_dir=~/sieve
- Make sure /usr/libexec/dovecot/deliver exists and is executable.
5. If your mbox is in /var/spool/mail/yourname (or in /var/mail/yourname), i.e. mine is /var/spool/mail/tin, then you can run the following command to exchange that mbox into maildir.
mb2md -s /var/spool/mail/tin
mb2md will automaticaly make a directory named Maildir in your home directory (i.e. it made /home/tin/Maildir for me). The converted maildir files will go in there (from /var/spool/mail/tin).
My filtered incoming mail (via procmail) is in the mail directory of my home directory, i.e. /home/tin/mail. There are multiple directories and multiple mbox files in there.
There are also directories such as .imap directory, made by dovecot. Anything there that is not a valid mbox file will be unseen by mb2md.
So now run
mb2md -s /home/tin/mail -R
That should recursively travel into your mail folder and exchange all mbox files there into maildir format in your Maildir directory.
I did found some mbox files that was unseen or failed to exchange. But manually running mb2md on those file worked, e.g. mb2md -s /home/tin/mail/missed-mbox-file.
To make sure there won’t be an accident, I renamed my mail folder to mail.ancient. Then start up postfix, dovecot.
I’ll add more information about the .dovecot.sieve file later.
REFERENCES
http://blog.tinle.org/2009/10/14/converting-from-mbox-to-maildir-procmail-to-deliverdovecotsieve/
Check it out:Command Center SkyHi




(out of reviews)


![Anti Virus Plus 2012 - 3 Users/2 Year [Download] Reviews](http://ecx.images-amazon.com/images/I/51npwXKcFUL._SL160_.jpg)

Answers Rating