![使用 doveadm-backup 将邮件从 Gmail 迁移到 Dovecot 的正确方法是什么?](https://linux22.com/image/732023/%E4%BD%BF%E7%94%A8%20doveadm-backup%20%E5%B0%86%E9%82%AE%E4%BB%B6%E4%BB%8E%20Gmail%20%E8%BF%81%E7%A7%BB%E5%88%B0%20Dovecot%20%E7%9A%84%E6%AD%A3%E7%A1%AE%E6%96%B9%E6%B3%95%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F.png)
Dovecot 文档远非完美,因此我有点困惑如何将邮件从 Gmail 传送到本地 Dovecot。
看:https://wiki.dovecot.org/Migration/Gmail
经过一番努力,我终于实现了一个用户的同步,但是有没有什么可以针对 Gmail 及其不寻常的标签/虚拟文件夹进行调整呢?
我是否理解正确,每个 gmail 用户必须单独同步,即通过循环,因为无法将多个密码用户文件写入(doveadm backup -F $file
)。
IIUC 远程用户必须在本地 Dovecot 中进行配置。
我目前有:
# 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
}
正在进行同步:
# doveadm -v -o [email protected] -o \
imapc_password='gmailuser_password' backup -O '-$GmailHaveLabels' \
-R -x '\Flagged' -x '\Important' -u [email protected] imapc:
同步后,我得到了这个:
# 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/