#copy mailbox, using new mail_location setting
doveadm backup -u "${USER}" maildir:/home/${USERNAME}/Maildir/
doveadm sync -u "${USER}" maildir:/home/${USERNAME}/Maildir/
#Update user to use maildir instead of old method, update sql?
.... mail_location=maildir:/home/${USERNAME}/Maildir/
doveadm auth cache flush
doveadm proxy kick "${USER}"
#copy any late additions to mailbox, using old mail_location setting
doveadm sync -u "${USER}" mbox:/var/mail/${USERNAME}
#remove old format mailbox
rm /var/mail/${USERNAME}
I do this one user at a time, then when done adjust my config file,
and remove the mail_location setting from sql, though my script has a
few other fixups and error checking
Quoting Kenneth Irving <ken at fq.edu.uy>:
> Hello. I have an email server for testing purposes, using postfix
> 3.5.17 and dovecot 2.3.13.
>
> Initially, I configured postfix to use mailboxes, but now I've
> changed it to maildir.
>
> Emails arrive fine, and dovecot manages them well by pop3 or imap.
> No problems there.
>
> But I still have a lot of emails in different mailboxes which I'd
> like to convert to maildir.
>
> I found mb2md, which seems to do a pretty good job. Once the mailbox
> is converted, dovecot manages the emails without a problem.
>
> But I also wanted to learn how to use doveadm to convert mailboxes
> to maildir format.
>
> I read all the documentation I could find and tried to learn how
> this command works. I tried different combinations, but couldn't
> convert mailboxes to maildir. I always get error messages. I've been
> unable to understand why.
>
> I tried to sync, backup, and import, to no avail. I also tried
> dsync, which seems to have a different syntax, with the same result.
>
> Sorry for bothering you, but if you could explain to me how this
> command works, I'd be very grateful.
>
> Example: I have a user, let's say joe, who has a mailbox in
> /var/mail/joe and I'd like to transfer those emails to
> /home/joe/Maildir
>
> How do I use doveadm in this situation?
>
> Best regards
>
> Kenneth