This blog describes how I set up email in Emacs with the help of
mu4e. First of all, I
need a program to synchronize emails in my local drive with the server.
There are several options for this purpose, with two of the most popular
ones being offlineimap and
mbsync. I actually tried offlineimap
first and was able to make it work together with mu and mu4e. There are
two methods to specify the password of email account in offlineimap’s or
mbsync’s configuration files. The easiest way is to specify password in
plain text directly in the configuration files, which may be a bad
example for security reasons. The second one is to specify the password
in a file, e.g.
.authinfo and then encrypt the file with
GnuPG. Offlineimap and mbsync both support a
gpg decryption command to retrieve the password from the encrypted file
.authinfo.gpg). However it will ask passphrase for the gpg key every
Since I want to sync my emails automatically every several minutes in mu4e, it would be ridiculous if I need to enter the passphrase each time. gpg-agent can solve the problem by remembering the keys in background so that I only need to type the passphrase once when I started my computer. Unfortunately, offlineimap does not play well with gpg-agent and mu4e and that is exactly why I settled down on mbsync finally.
I have come across lots of excellent tutorials on this matter during my setup. I will not reinvent the wheel by posting how exactly I configured mbsync and mu4e. The following links should be sufficient if I ever face those problems again in the future.
The last one the most import information about setting gpg-agent on mac os x.