Convert from mbox to Maildir

David.M.Clark david at davrom.com
Fri Oct 13 04:34:22 EEST 2017


Hi Josef,

Just went through this one recently using CentOS with SendMail, Procmail 
and IMAP conversion from mbox to Maildir - I needed to make sure I could 
run both formats while I migrated users one-by-one.

Not sure if what I did helps, but I created a 'how-to' page on it on my 
website rather than post an essay on the e-mail forum:

http://dmc1961.id.au/howto_17101101.php

In essence I am using /etc/procmailrc and the users_db approach to get 
e-mail delivered correctly after I have converted an account to Maildir 
format. I also never trust anything in my IT life, so I backup the mail 
directories under $HOME to mail_old.

Not sure if this is any use to you but works for me now.

On 13/10/17 07:52, Josef Wolf wrote:
> 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?
> 

-- 

As always, I remain at your service.

Kindest Regards,
David.M.Clark (Director - Senior Linux/UNIX Consultant)
=--------------------------------------------------------------------------=
  Davrom Consulting Pty Ltd            Mobile: 0418763124
  PO Box 1644, Sunnybank Hills, 4109   E-mail (Work): david at davrom.com
  ABN: 81 096 990 804                  E-mail (Priv): dmc1961 at dmc1961.id.au
  Website: http://davrom.com           Skype: dmc1961
  Podcast: http://ldup.com.au          Google: dmc1961 at gmail.com
=--------------------------------------------------------------------------=
  Specialising in: Linux (Fedora/RedHat/CentOS), UNIX, SCO, MikroTik,
                   Networking/Internet, E-mail/Web Technologies
=--------------------------------------------------------------------------=
  Please note: Any e-mail communication bearing this signature is for
  the exclusive purpose of the sender and is not for publication
  without the expressed permission of the sender or respective
  sender's organisation.
=--------------------------------------------------------------------------=



More information about the dovecot mailing list