[Dovecot] conversion to maildir

Ian R. Justman ianj at ian-justman.com
Wed Aug 27 17:25:19 EEST 2003



Bob Hall wrote:

>>Why don't you convert your mbox files using formail and procmail?
> 
> 
> Because I don't know how. Can you post a script? or guidelines and 
> suggestions?

It's mind-numbingly easy.

As for getting the mail into Procmail, that's where Formail comes in.  You 
tell it to parse the mailbox, spitting out one message at a time, which you 
then feed back into Procmail which goes by your rules.  As it goes, it'll 
then re-deliver based on your rules.

This example is based directly from the set of examples from Formail's man 
page:

cat mailbox | formail -ds procmail

With your Procmail recipes, follow your mailbox name with a slant, e.g.:

:0:
* 1^0 ^Return-Path:.*dovecot-bounces at procontrol.fi
* 1^0 ^Return-Path:.*dovecot-bounce at procontrol.fi
/home/ianj/maildir/dovecot/

This one is based on a real recipe which on my system does a mbox by month, 
augmented to deliver to a maildir.

and bingo!  Any subsequent mail will be delivered to a maildir.  The cool 
part is that you don't have to do anything special beforehand.

For a main inbox, you'd remove the condition lines, and of course, specify 
the path to the directory (followed by a slant to tell Procmail that you 
want maildir delivery).

Though one of the other people on the list mentioned wanting to be able to 
make maildir the system-wide default mailbox format for users' inboxes, 
which of course can be overridden in ~/.procmailrc.  Any thoughts on this 
one?  I may move my inbox to a maildir format while all my mailing list 
traffic will be filed in monthly mbox files since I rarely make any writes 
to those files from my MUA to begin with.

--Ian.




More information about the dovecot mailing list