我可以使用什么来自动备份 Gmail?

ænd*_*rük 23 imap backup

我想自动执行本地备份我的 Gmail 帐户的过程,并且正在寻找一种解决方案:

  • 可以安排在后台运行
  • 不会导致消息被标记为已读

有哪些资源可用于在 Ubuntu 中执行此操作?

Jor*_*tro 25

离线地图 安装离线地图 是一个流行的解决方案。

在 GMail 中启用 IMAP

谷歌的说明

  1. 登录 Gmail。
  2. 点击任意 Gmail 页面顶部的设置。
  3. 单击转发和 POP/IMAP。
  4. 选择启用 IMAP。
  5. 配置您的 IMAP 客户端并单击保存更改。

设置离线地图

安装后创建一个 .offlineimaprc

[general]
accounts = GMail
maxsyncaccounts = 3

[Account GMail]
localrepository = Local
remoterepository = Remote
autorefresh = 10  #refresh every 10 minutes
quick = 5         #Quick-syncs do not update if the only changes were to IMAP flags

[Repository Local]
type = Maildir
localfolders = /whatever/directory

[Repository Remote]
type = IMAP
remotehost = imap.gmail.com
remoteuser = your_username@gmail.com
remotepass = your_password
ssl = yes
maxconnections = 1

#Setting realdelete = yes will Really Delete email from the server.
#Otherwise "deleting" a message will just remove any labels and 
#retain the message in the All Mail folder.
realdelete = no 
Run Code Online (Sandbox Code Playgroud)

然后你需要运行offlineimap。

使用 cron 自动化离线地图

在某些情况下,一直运行offlineimap会消耗大量内存,特别是如果你有一个大邮箱,那么你可以在cron中添加一个offlineimap check就可以检查然后退出,这里是每日备份:

 @daily offlineimap -u Noninteractive.Basic
Run Code Online (Sandbox Code Playgroud)

备份离线地图

这些文件将位于您在 localfolders 行中定义为Maildir 的任何内容中。您可以使用您使用的任何备份方法来备份它:

参考