OfflineIMAP
·1 min
Here’s how I setup OfflineIMAP to take regular backups of our Gmail accounts:
# Install, on Raspberry Pi.
sudo apt install offlineimap3
cat > ~/.offlineimaprc << 'EOF'
[general]
accounts = foo1, foo2
[Account foo1]
localrepository = foo1-local
remoterepository = foo1-remote
synclabels = yes
# This header is where labels go. Usually you will be fine
# with default value (X-Keywords), but in case you want it
# different, here we go:
labelsheader = X-Keywords
[Repository foo1-remote]
type = Gmail
sslcacertfile = OS-DEFAULT
remoteuser = foo.1@gmail.com
remotepass = pass1
readonly = True
[Repository foo1-local]
type = GmailMaildir
localfolders = /srv/dev-disk-by-uuid-28fd4901-c675-430d-be16-e1ffddc50727/Backups/Emails/foo.1@gmail.com
[Account foo2]
localrepository = foo2-local
remoterepository = foo2-remote
synclabels = yes
# This header is where labels go. Usually you will be fine
# with default value (X-Keywords), but in case you want it
# different, here we go:
labelsheader = X-Keywords
[Repository foo2-remote]
type = Gmail
sslcacertfile = OS-DEFAULT
remoteuser = foo.2@gmail.com
remotepass = pass2
readonly = True
[Repository foo2-local]
type = GmailMaildir
localfolders = /srv/dev-disk-by-uuid-28fd4901-c675-430d-be16-e1ffddc50727/Backups/Emails/foo.2@gmail.com
EOF
Other resources:
- Official links:
- https://github.com/imapsync/imapsync - only syncs between 2 IMAP accounts. Not what I (currently) want.