Continuously keep local mailboxes in sync with an IMAP server
27 points by runxiyu
27 points by runxiyu
I currently use OfflineIMAP with a systemd timer to backup a few email accounts once an hour. I'll have to see how this compares! The big problem I need to solve is that one of my email accounts stopped accepting password authentication and I need to figure out XOAUTH2, but this may not have that yet anyway. All that to say, I'm happy to see another option in this space!
Also consider local auth proxies that allow clients speaking simpler version of protocols to get authentication via OAuth2 added for them in a separate program. DavMail can even handle some configurations of Exchange server (fun fact: Exchange configured to block clients other than MS Outlook, «for security», just filters by the client-sent «client UUID»).
That way you can pick proxies per-server and the syncer based on syncing features!
This sounds cool!
I used to run Thunderbird solely for the purpose of keeping a local copy of my inbox, but whenever I tried to use it when I actually didn't have access to my real mail server, I found that it hadn't stored all of my messages locally. And it stores everything in a Thunderbird-specific format in giant files, and the files got corrupted easily.
I switched to offlineimap and was disappointed that it wasn't more actively developed, but it seemed to just do its job fine.
I like that ImapGoose takes advantage of modern protocol options and is implemented in Go (a better fit for this task, in my opinion than offlineimap's Python).
Out of curiousity, does anyone have a good client for reading maildir files from a directory? There's a list on Wikipedia, I found that most of them are just compatible with exporting to maildir but don't actually work well reading a maildir directory with the exception of Mutt, which is a TUI.
gnome's evolution has a ‘local directory’ account type (or similarly named – typing from phone right now) that does just that: browse a maildir tree (multiple folders/mailboxes). you can drag&drop messages to/from other accounts (e.g. imap)
Thanks for your reply!
Have you done this successfully?
I've tried doing this and set "Server Type" to "Maildir-format mail directories," specify my maildir root, and create the account, but then it just doesn't show me anything in the folder.
I tried again and tried setting a specific maildir folder (e.g. my "sent mail" folder rather than the maildir root), and nothing happened, but if I closed and reopened Evolution, it loaded my mail for that folder. But the problem is I have 50+ folders on my IMAP server (and consequently 50+ in my local maildir copy). Would I need to create an account for each folder?
yes, i have done this successfully. the evolution account points to ~/path/to/test-maildir/, which has the following structure:
$ tree -a -d test-maildir/
test-maildir/
├── cur
├── new
├── .test
│ ├── cur
│ ├── new
│ └── tmp
└── tmp
this shows up as an ‘inbox’ and a folder ‘test’. note that the folder ‘test’ is named ‘.test/’ (leading dot, hidden directory) in the file system, since that's how maildir works.
Oh, neat! I was trying to make an IDLE-based imap syncing tool back in 2013 and gave up when Gmail’s mail service locked up my account in a very funny way when I sat IDLEing on the All Mail mailbox for a few hours. Sounds like that extension works better now (and I no longer use Gmail, heh).
I've used offlineimap, isync/mbsync, and fdm for many years and this seems to address one of the pain points I had with these: delayed synchronization. E.g. when someone on the phone sends you an email you have to wait until your cronjob fires.
The original title is “Introducing ImapGoose”. I munged it because “ImapGoose” out of the blue is probably not very useful for most people.
Have you tried running it? If it's retrying every 17 mins while offline, does it recognise when you are back online or do you risk waiting 17 mins for mail to begin to flow again?
According to the code, it sleeps for up to 5 minutes before the next try (no earlier check if online or not).