Emacs RMAIL with CalMail

From UCB Math Wiki
Jump to: navigation, search

Using Emacs for mail

I'm a die-hard user of emacs for mail. Here's one possible way to make it work with CalMail.

Sending mail from emacs (on a math department machine) should not require any changes.

Reading mail in RMAIL mode can be done by setting up RMAIL to use fetchmail before getting new mail, as follows.

1. Follow the initial setup instructions for fetchmail on the CalMail conversion and Unix mail page.

2. In your .emacs file, put the lines:

(defun rmail-run-fetchmail nil (shell-command "fetchmail -k"))
(setq rmail-before-get-new-mail-hook 'rmail-run-fetchmail)
(setq rmail-primary-inbox-list (list (expand-file-name "~/inbox")))

Here I assume you configured fetchmail to put mail in the file "inbox" as in the example on the instructions page.

The shell command fetchmail -k on the first line above will leave a copy of your mail on the server. If you want it deleted from the server instead, drop the -k.

This works with emacs on my linux workstation, which is emacs version 21. In emacs version 22, it should in principle be possible to configure RMAIL directly to get mail from the IMAP server, without the fetchmail workaround. However, this also requires that the GNU mailutils version of RMAIL's helper program movemail be available. Currently, the latter is only installed on the Solaris systems.

An alternative emacs mail reader called VM should also support IMAP. It is not distributed with emacs nor currently installed on our system, though one could download and install it in one's own home directory. For VM to work with secure (SSL encrypted) IMAP, as used by the CalMail server, it needs a helper program, stunnel, which is also not currently installed on our system.

--Mark Haiman