Hi everyone,

I'm trying to migrate my gmail to dovecot following instructions at https://wiki.dovecot.org/Migration/Gmail

Using -a 'virtual/All' option does not seem to work because the gmail folder with that name does not exist, but -a '[Gmail]/All Mail' seem to work. I'm using the following command:

sudo doveadm \
-o imapc_host=imap.gmail.com \
-o imapc_user=user@gmail.com \
-o imapc_password=gmailpassword \
-o imapc_features="rfc822.size gmail-migration" \
-o imapc_port=993 \
-o imapc_ssl=imaps \
-o ssl_client_ca_dir=/etc/ssl/certs \
-o imapc_ssl_verify=yes \
backup -a '[Gmail]/All Mail' -O '-$GmailHaveLabels' -R -u user@exmaple.com imapc:

The problem is this command only migrates approximately 25% of my emails by size. Google Takeout exports 4 times more data in mbox format, the size of exported mboxes aligns with what Google tells me a the bottom of gmail settings page.

I experimented with other options of 'doveadm backup' command, but they all resulted in less data being migrated. The above options are the best I was able to achive so far.

Another option I was considering is to convert Google Takeout mboxes to dovecot format. I tried using 'doveadm import' command, but got confused with various user and search query options of the command. The best I was able to achive was to output a folder under /Takeout which mimics my mbox structure, but with no imported messages.

A third option I'm considering is to convert Google Takeout mboxes using mb2md command. Conversion seems to work fine, but the output is in the traditional (dotted) format, and for historical reasons I use 'LAYOUT=fs' option. So I need to do some extra work to convert folder names. And even if I do so, I'm still not sure if I can import Maildir to dovecot because dovecot's Maildir has other information, such as indices, logs, etc., not just email folders.

I'll keep investigating the second and the third option because it seems that Google Takeout gives me all my emails, but I'm not sure if those are the right paths.

I wanted to ask the experts about the best option to migrate gmail to dovecot. Has anyone being able to successfully migrate all their emails from gmail and what steps have been used for that?

My Dovecot version: 2.3.4.1

Thank you,
Yuri