Reading email (from gmail) in emacs 24
After trying many ways, I now use offlineimap to sync messages between my machine and the google server. Gnus then reads messages from the local machine. Postfix is used to send messages to the gmail smtp server. Virtues of this setup: reading/sending email does not involve waiting for servers while in gnus (fast), can read/send email while offline (passed to server when online again). If you preferred to use RMail, you could instead of gnus.
This is what I do on ubuntu 13.10.
offlineimap, run periodically puts mail into ~/Maildr/Gmail
contents of ~/.offlineimaprc:
[general]
# List of accounts to be synced, separated by a comma.
accounts = Gmail
maxsyncaccounts = 2
[Account Gmail]
# Identifier for the local repository; e.g. the maildir to be synced via IMAP.
localrepository = Gmail-local
# Identifier for the remote repository; i.e. the actual IMAP, usually non-local.
remoterepository = Gmail-remote
# Status cache. Default is plain, which eventually becomes huge and slow.
status_backend = sqlite
[Repository Gmail-local]
type = Maildir
localfolders = ~/Maildir/Gmail
[Repository Gmail-remote]
type = Gmail
remoteuser = [email protected]
remotepass = YourPass
folderfilter = lambda foldername: foldername in ['INBOX', 'Dev']
# Necessary as of OfflineIMAP 6.5.4
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
gnus reads mail from ~/Maildir/Gmail
In emacs, the variable gnus-home-directory is set to "~/Documents/gnus". Contents of "~/Documents/gnus/.gnus":
(setq gnus-select-method
'(nntp "localhost")) ; I also read news in gnus; it is copied to my local machine via **leafnode**
(setq gnus-secondary-select-methods
'((nnmaildir "GMail" (directory "~/Maildir/Gmail")) ; grab mail from here
(nnfolder "archive"
(nnfolder-directory "~/Documents/gnus/Mail/archive") ; where I archive sent email
(nnfolder-active-file "~/Documents/gnus/Mail/archive/active")
(nnfolder-get-new-mail nil)
(nnfolder-inhibit-expiry t))))
Sending mail: emacs configuration variables: mail-user-agent is set to 'gnus-user-agent send-mail-function is set to 'sendmail-send-it user-mail-address is set to "[email protected]"
Trickiest thing is setting up Postfix, that is clearly described here:
Further comments to address questions:
The program offlineimap is controlled by the file ~/.offlineimaprc. When offineimap runs, it will keep information in the directory ~/.offlineimap. You can read the docs for explanation of how that all works.
Re: sending mail: In fact, I used to do send mail directly from emacs. This involved fiddling with a number of things. It turned out to be much easier to just let postfix handle it. For example, I use several different email accounts to send mail from in Gnus; I now let gnus know about this via posting-styles, and let postfix worry about which address should go to which server, and how.
Indeed mu4e is my choice: http://www.djcbsoftware.nl/code/mu/mu4e.html
edit: I also tried notmuchmail and fetched emails with mbsync
(isync
Debian package). mbsync got certificates support out of the box when offlineimap needed a configuration step. Some say it is more reliable. I prefer notmuch's display of conversations.
- I couldn't find good documentation for Wanderlust. It is said to be cryptic to install.
- I regularly hear Gnus rocks but hangs when retrieving the mail. Never tried though. mu4e is asynchronous.
- mu4e doc is excellent, especially if you want gmail: http://www.djcbsoftware.nl/code/mu/mu4e/Gmail-configuration.html#Gmail-configuration
- it comes with the
mu
shell command which is nice to find mail on the terminal too http://www.djcbsoftware.nl/code/mu/
So mu4e uses offlineimap to fetch the mail, mu
to index it and mu4e to show it in emacs.
One can even write rich text mails using org-mode ! It's still experimental but here's an example on how to include math formula and a plot written in python.
ps:
- http://wikemacs.org/index.php/Category:Email and
- a list of mu4e extensions: http://wikemacs.org/wiki/Mu4e (notifications, contact completion, schedule email,…)
I'm not sure there's a "current authoritative way"?
Make sure you look at http://www.emacswiki.org/emacs/CategoryMail
mu4e sounded quite nice to me, but as I never got around to actually configuring this sort of thing for myself, I can't make any recommendations.
http://box.matto.nl/emacsgmail.html (for the Wanderlust client) is certainly relevant.