Convert from mbox to Maildir

Nikolai Lusan nikolai at lusan.id.au
Fri Oct 13 14:44:39 EEST 2017


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Greetings,

On Fri, 2017-10-13 at 11:34 +1000, David.M.Clark wrote:

> 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.

When I have migrated solutions from mbox to maildir (I have done more than
one) I found it easier to get a mail client to do the hard work for me (if
you're on a LAN with the server it's faster). I created new usernames with
maildir as their base, and copied the folder over. This approach could be
automated, probably easier than going via a script to open each mbox and
push each message through an LDA. There are a heap of examples around for
connecting to IMAP via PERL (https://www.example-code.com/perl/imap.asp is
good). If you write your perl script properly you could migrate multiple
users at once from the cli ... xargs is a wonderful tool :). Unless you are
hosting a mail service that needs to be up 24/7 you should be able to
migrate large amounts of mail out of hours. If you have users that have
been using POP to get their email and want to move them to IMAP it's also
easier to have the MUA do the work (I have migrated users from using POP
and local storage, to remote IMAP this way - especially users of MS
Outlook).


> 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.

Yeah, safe bet there. Creating copies before starting the migration process
 is the best way (depending on the underlying filesystem also probably
faster if you need to restore something). Even using a second copy as the
base to push things from mbox into a new maildir.

While I like procmail (it has some nice features), I also migrated things
to sieve a while back. There are a couple of things I can do with procmail
that I have found it hard to match with sieve, but properly nested if
statements mean I can traverse my rules faster. Most people will end up
using MUA filters on an inbox rather than a procmail/sieve setup (the
number of MUA's that support either of these server side filters is
minimal, and the number that support them properly is even smaller - I did
have a webmail client destroy my nested "if" statements). Using procmail or
sieve as an intermediate step for initial transition from mbox to maildir
is a safe bet, then it comes down to having dovecot setup properly to
deliver into maildir.

- -- 
Nikolai Lusan <nikolai at lusan.id.au>
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEVfd4GW6z4nsBxdLo4ZaDRV2VL6QFAlngpycACgkQ4ZaDRV2V
L6SDsxAAn65oBEhOb4HxOzL5oAg+GREziMEcav0iOkXwjkGi6ithX3xc5T9vgA36
dJWDgkTdTVN82vaZKu3Eg7V8baqld5l6alFRJv5nhU3G37m287SapxCG3smwT8OA
2y3SAkPJO905cOcINYGESIMLtBtRSympDcVtM8+gHjy7+xSWiiaxEt3wSojbmrAT
NqunbuBCrDQXK5GeWYBcOPTHj+7Qb3CEGCEo3mTDtgIBsNRpw07PIc+px0KbRJT2
4h5Gft1IzHUC9b63yRXUK7O00SAxxjAQ2fJAmjq5kBxPuwmW70pbcQMPrTQd4HAL
X8QtzoqoLPCLHu3Ptx5eRLpw3IUSiHWFeBZGG/5RWx/GPyzKFMMFmSURKjxmVbkG
imo+2vR8LgBFsE1KXc7cRPjkHaTJNus9N7LvWepR/uSDthXJGWpYttCilAm9wmRG
usflda8Qqq+AJxiUOYP4n+Qu130yNaW0K5T4LJRVJ1DHiQcRRrk6D+r8wpmG6nBi
jrJR7/ge2mk+axl1PBJklAycTxdjEFwdXA3/NmBA0nN1NLxMMdVMneipGuAYQVP7
JJA6mMySMahj1c9DSDj8O8x3cbc2uSXSB7AzKogRnnWeKewh1DoEIeVSiMwJysvS
0lNEWGIzE/cXG72JQniDGrKLZZN5yJEuKZPiSmEbJB/rYOyGpGE=
=JJgP
-----END PGP SIGNATURE-----



More information about the dovecot mailing list