index rss mastodon twitter github linkedin email
Álvaro Ramírez

Álvaro Ramírez

17 June 2018 Trying out mu4e with mbsync

The email fun in Emacs continues. After a few weeks since I started using mu4e and offlineimap, I'm sold. Both are awesome. Mbsync is an offlineimap alternative. Despite resyncing all my mail, the transition was fairly smooth. Here's how…

Install isync (for mbsync)

brew install isync

Configure mbsync

Mbsync uses ~/.mbsyncrc for configuration. Migrating ~/.offlineimaprc to ~/.mbsyncrc looks like:

IMAPAccount Personal
User your_user_name
PassCmd "gpg --quiet --batch -d ~/.offlineimap_accountname.gpg"
Port 993
AuthMechs Login
CertificateFile  ~/.offlineimapcerts.pem
# My IMAP provider doesn't handle concurrent IMAP commands.
PipelineDepth 1

IMAPStore Personal-remote
Account Personal

MaildirStore Personal-local
Path ~/IMAP/Personal/
Inbox ~/IMAP/Personal/INBOX

Channel Personal
Master :Personal-remote:
Slave :Personal-local:
Patterns *
Create Slave
Sync All
Expunge Both
SyncState *

No concurrent IMAP commands supported

My IMAP provider doesn't handle concurrent IMAP commands. mbsync and Office 365 had the answer:

PipelineDepth 1

Initial sync

Run initial from the command line sync:

mbsync -Va

While syncing my largest inbox, it sometimes received an unexpected EOF error:

IMAP error: unexpected EOF from (

First few times, I restarted the syncing manually, but then used a loop to automatically restart it.

Bash loops:

while true; do mbsync -V Personal; sleep 5; done
for i in {1..5}; do mbsync -V Personal; sleep 5; done

Eshell loop:

for i in (number-sequence 1 10) {mbsync -V Personal; sleep 5}

Create mu index

Reindex using mu, but first remove existing index for offlineimap messages:

rm -rf ~/.mu

Ok, do index now:

mu index --maildir=~/IMAP

Mu4e tweaks

The get mail command should now point to mbsync.

(csetq mu4e-get-mail-command "mbsync -Va")

I had issues with duplicate IDs after moving and deleting messages from mu4e. Migrating from offlineimap to mbsync for mu4e had the answer:

(csetq mu4e-change-filenames-when-moving t)