Mbox2maildir

From wiki.welmers.net

Jump to: navigation, search

I have already wanted to convert my system from mbox to maildir for performance reasons for a while. When I had to use NFS shared storage I had to, due to locking woes when using mbox files.

Things that had to be done:

  • set up a testing mail server as a clone of the current mail server, with some mailboxes in it
  • experimenting with mb2md
    • http://batleth.sapienti-sat.org/projects/mb2md/ is quite usefull for converting both inbox spool files and local imap clients
    • doing per user:
      • mb2md -m to transform inbox /var/mail/user to ~user/Maildir
      • mb2md -s ~user/ -R to transform al ~user/mbox files to ~user/Maildir/.mbox/ folders, so it will be properly readable by the Imap client
  • adding following to /etc/postfix/main.cf:
home_mailbox = Maildir/
  • changed /etc/dovecot/dovecot.conf:
mail_location = maildir:~/Maildir:INDEX=/var/cache/dovecot-indexes/%u
  • using following in .procmailrc:
MAILDIR=$HOME/Maildir
DEFAULT=$HOME/Maildir/
ORGMAIL=$DEFAULT

and using things like this for sorting:

:0:
* ^Received:.*for <admin@welmers.net>
.admin/
  • muttrc:
set mbox_type=Maildir

set spoolfile="~/Maildir/"
set folder="~/Maildir/"
#set mask="!^\\.[^.]"
set record="+.sent-mail"
set postponed="+.Drafts"

mailboxes ! `\
 for file in ~/Maildir/.*; do \
   box=$(basename "$file"); \
   if [ ! "$box" = '.' -a ! "$box" = '..' -a ! "$box" = '.customflags' \
       -a ! "$box" = '.subscriptions' ]; then \
     echo -n "\"+$box\" "; \
   fi; \
 done`

macro index c "<change-folder>?<toggle-mailboxes>" "open a different folder"
macro pager c "<change-folder>?<toggle-mailboxes>" "open a different folder"

Personal tools