This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!
offlineimap is a Python utility to locally sync emails from IMAP servers.
After trying it, I do not use it for those reasons:
offlineimapbrings dotfile madness with a
~/.offlineimapfolder and a
~/.offlineimaprcfile (I did not found any way to avoid it).
If you are using
offlineimapwith a cyphered mailbox (like a ProtonMail one) your emails won't be cyphered locally after syncing.
The current available version (
v6.5.6) has still some annoying bugs.
Table of contents¶
offlineimap (pay attention to the
$ vi ~/.offlineimaprc > [general] > accounts = main > > > [Account main] > localrepository = main-local > remoterepository = main-remote > > # full refresh, in min > autorefresh = 0.2 > > # quick refreshs between each full refresh > quick = 10 > > # update notmuch index after sync > #postsynchook = notmuch new # if you intend to use notmuch > > > [Repository main-local] > type = Maildir > localfolders = ~/.mail > > # delete remote mails that were deleted locally > sync_deletes = no > > > [Repository main-remote] > type = IMAP > remoteport = 1143 # imap port for protonmail-bridge > remotehost = 127.0.0.1 # host for local protonmail-bridge > remoteuser = <your-user-email-address> > remotepass = <your-user-pass> # if any, otherwise comment this line > keepalive = 60 > holdconnectionopen = yes > > # delete local mails that were deleted on the remote server > expunge = yes > > # sync only these folders > folderfilter = lambda foldername: foldername in ['INBOX', 'Archive', 'Sent'] > > # is broken, but connecting locally to bridge so should be ok > ssl = no
Known bug in
If you get the following error:
OperationalError: unable to open database file
In my case, it happened because the status file of the folder on
~/.offlineimapdirectory was corrupted because of a system crash. Deleting this file and setting
status_backend = plainin
The solution I found (very bad, though) was to delete the status file (e.g.:,
~/.offlineimap/Account-XXX/LocalStatus/folder_nameand the entire folder in $MAIL directory and re sync everything again.
If this cheat sheet has been useful to you, then please consider leaving a star here.