Convert from mbox to Maildir

Josef Wolf jw at raven.inka.de
Fri Oct 13 00:52:44 EEST 2017


Hello everybody,

I am in the process to install dovecot as an IMAP server.

Currently, this system runs postfix and uses procmail for local (mbox
style) delivery.

Procmail ist started by postfix like this:

    /etc/postfix/main.cf:
        mailbox_command = /usr/bin/procmail

    ~/.forward:
        "|IFS=' ' && exec /usr/bin/procmail -f- || exit 75 # jw"

Before going into IMAP details, I decided to convert the system to
Maildir as a first step. So I created a procmail-entryrecipe to populate
a test folder:

    ~/.procmailrc:
        :0
        * ^Subject:.*dovecot-test
        {
          ORGMAIL="${HOME}/Maildir/"
          DEFAULT=${ORGMAIL}
          DELIVER="/usr/lib/dovecot/deliver -o mail_location=maildir:~/Maildir -o lda_mailbox_autocreate=yes"
          :0
          | $DELIVER -m dovecot-test
        }

This setup seems to work.

But there is one point that bugs me: in the first tests, dovecot was
mis-configured (the two -o options were missing) and the test mails
were silently lost. No errors in the procmail logfile. Only dovecot
reports errors in its logfile. But the error seems not to be noticed
by procmail. Therefore procmail assumes deliver could store the mail
successfully and won't keep a backup of it.

I am sure, I'm doing something stupid here. I have never seen such
behavior from procmail before. Normally procmail would report failure
of sub-commands.

Now I hesitate to go forward in this conversion process. I don't want to
loose mails if something is wrong with the dovcot setup.

Besides: I wonder whether the setting

          DEFAULT=${ORGMAIL}

is a good idea. Wouldn't it be better to have

          DEFAULT=/var/spool/mail/$USER

so there would be a fallback in case there are delivery problems to
${ORGMAIL}

Any thougths?

-- 
Josef Wolf
jw at raven.inka.de


More information about the dovecot mailing list