#!/bin/cat
$Id: FAQ.Dovecot.txt,v 1.14 2022/06/16 09:06:34 gilles Exp gilles $

This documentation is also available online at
https://imapsync.lamiral.info/FAQ.d/
https://imapsync.lamiral.info/FAQ.d/FAQ.Dovecot.txt


=======================================================================
      Imapsync tips for Dovecot. Specific issues and solutions.
=======================================================================


Questions answered in this FAQ are:

Q. Is there imapsync specific options to deal with Dovecot?

Q. The login fails with the error:
   Err 1/1: Host2 failure: Error login on [...] with user [...] auth [LOGIN]: timeout waiting 120s for data from server (5x)
   What can it be?

Q. Subfolders are not created by imapsync and the error is
   "Mailbox doesn't allow inferior mailboxes"

Q. How to migrate to Dovecot with an admin/MasterUser account?

Q. I have a mailbox that "dovecot backup" gives errors on that
   I can't get rid of: "UID inserted in the middle of mailbox".
   What can I do?

Q. Imapsync encounters timeouts and Dovecot log says
   "mailpiler dovecot: imap(xxx): Error: Timeout (180s) while waiting for dotlock for transaction log file ..."
   What can I do?

Now the questions again with their answers.

=======================================================================
Q. Is there imapsync specific options to deal with Dovecot?

R. Dovecot is ok with imapsync, nothing special is needed, just the
   basic options, ie, the credentials, are needed.

=======================================================================
Q. The login fails with the error:
   Err 1/1: Host2 failure: Error login on [...] with user [...] auth [LOGIN]: timeout waiting 120s for data from server (5x)
   What can it be?

R. It can be special characters in the password. Change it with only
   normal characters, characters from a-z A-Z 0-9

=======================================================================
Q. How to migrate to Dovecot with an admin/MasterUser account?

R. Dovecot uses the same syntax as uw-imap

  imapsync ... --user2="loginuser*admin_user" --password2 "admin_user_password"

To setup a Dovecot MasterUser follow the document
https://doc.dovecot.org/configuration_manual/authentication/master_users/

=======================================================================
Q. I have a mailbox that "dovecot backup" gives errors on that
   I can't get rid of: "UID inserted in the middle of mailbox".
   What can I do?

Q. Solution, run:

  doveadm -v deduplicate -m -u martin mailbox A/Posted

it will get rid of the duplicates (I can also be run without "-m")
and this also allows "dovecot backup" to work.

Thanks to Martin Ward for this input!

=======================================================================
Q. Subfolders are not created by imapsync and the error is
   "Mailbox doesn't allow inferior mailboxes"

R. Dovecot usually supports subfolders with messages and subfolders,
   it's a Dovecot configuration issue.

If you can change the Dovecot configuration dovecot.conf, 
then try this:

mail_location = maildir:~/Maildir:LAYOUT=fs

See details at:
https://superuser.com/questions/813362/sub-folders-in-dovecot
https://wiki2.dovecot.org/MailLocation/Maildir


=======================================================================
Q. Imapsync encounters timeouts and Dovecot log says
   "mailpiler dovecot: imap(xxx): Error: Timeout (180s) while waiting for dotlock for transaction log file ..."
   What can I do?

R. It looks like an NFS issue with Dovecot. 
   Solve it with Dovecot support or use something else than NFS.
   I'll be glad to share here any solution you find.
   (Thanks to Mate Skoblar for reporting this issue)

=======================================================================
=======================================================================