0

Dovecot doc is far from being perfect, thus I'm little bit confused what is right way to get mails from Gmail to local Dovecot.

See: https://wiki.dovecot.org/Migration/Gmail

After some struggle I have working sync of one user but is there something which can be tuned for Gmail and its unusual labels/virtual folders?

Do I understand it right that each gmail user must be synced separately, ie. via a loop as there's no way to write multiple passwords users file (doveadm backup -F $file).

IIUC the remote user must be configured in local Dovecot.

I currently have:

# egrep -v '^(#|[ \t]*$)' /etc/dovecot/conf.d/99-migration.conf                                                                                                                                                                           
imapc_host = imap.gmail.com
imapc_features = rfc822.size
imapc_features = $imapc_features fetch-headers
mail_prefetch_count = 20
imapc_port = 993
imapc_ssl = imaps
imapc_ssl_verify = yes
imapc_features = gmail-migration

# sed -n '/^namespace inbox/,/^}/p' /etc/dovecot/conf.d/10-mail.conf | \
egrep -v '^([ \t]*#|[ \t]*$)'
namespace inbox {
      separator = /
      inbox = yes
}

Doing sync:

# doveadm -v -o imapc_user=gmailuser@example.com -o \
imapc_password='gmailuser_password' backup -O '-$GmailHaveLabels' \
-R -x '\Flagged' -x '\Important' -u gmailuser@example.com imapc:

And after sync, I got this:

# ls -lF /mail/example.com/data/gmailuser/Maildir/
total 112
drwx------  5 localuser  localgroup    512 Jan 13 22:45 .[Gmail].All Mail/
drwx------  5 localuser  localgroup    512 Jan 13 22:46 .[Gmail].Drafts/
drwx------  5 localuser  localgroup    512 Jan 13 22:46 .[Gmail].Sent Mail/
drwx------  5 localuser  localgroup    512 Jan 13 22:46 .[Gmail].Spam/
drwx------  5 localuser  localgroup    512 Jan 13 22:46 .[Gmail].Trash/
drwx------  2 localuser  localgroup   3072 Jan 13 22:44 cur/
-rw-------  1 localuser  localgroup      6 Jan 13 22:30 dovecot-keywords
-rw-------  1 localuser  localgroup   3684 Jan 13 22:43 dovecot-uidlist
-rw-------  1 localuser  localgroup      8 Jan 13 22:43 dovecot-uidvalidity
-r--r--r--  1 localuser  localgroup      0 Jan 13 22:30 dovecot-uidvalidity.5c3c0276
-rw-------  1 localuser  localgroup  21808 Jan 13 22:44 dovecot.index.cache
-rw-------  1 localuser  localgroup   3148 Jan 13 22:44 dovecot.index.log
-rw-------  1 localuser  localgroup    240 Jan 13 22:43 dovecot.mailbox.log
-rw-------  1 localuser  localgroup      0 Jan 13 22:30 maildirfolder
drwx------  2 localuser  localgroup    512 Jan 13 22:43 new/
-rw-------  1 localuser  localgroup    117 Jan 13 22:30 subscriptions
drwx------  2 localuser  localgroup    512 Jan 13 22:43 tmp/
Jiri B
  • 547
  • 2
  • 15
  • If it's an option for you, I use a crontabed fetchmail to pull my multiple mailboxes to my local maildir. And also a dovecot instance to expose local aggregated emails to my emails client (roundcube, thunderbird, mutt, ...) – Chaoxiang N Jan 15 '19 at 08:11
  • My question was more about migration from Gmail. I'll change topic. – Jiri B Jan 15 '19 at 08:13
  • Did you successfully transfer from Gmail to your server? – Paul Sep 29 '19 at 18:47

0 Answers0