problem converting mailbox to maildir with doveadm

Kenneth Irving ken at fq.edu.uy
Sun Feb 5 20:16:24 UTC 2023


Patrick: thanks a lot!

So it's not enough to do a 'backup', it's also necessary to 'sync' the 
mailboxes, but using the old mail_location, that is

mail_location = mbox:~/mail:INBOX=/var/mail/%u

Otherwise the command doesn't find the mailbox. It said source and 
destination were the same! That was one of many errors I was getting.

I had tried using '-o mail_location=/var/mail/' but also got errors and 
wasn't able to transfer the emails. I finally restored mail_location to 
it's former value, restarted dovecot, and it worked!

I wasn't aware that I had first to backup and then sync to transfer all 
emails.

Thanks again!
Best regards

Kenneth

On Sun, 5 Feb 2023, Patrick Domack wrote:

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


More information about the dovecot mailing list