How-to: Alpine and maildir (and offlineimap (and GMail)) — no more maildir patches!

Abstract

C Barrington-Leigh
The Red Pen
5 min readNov 16, 2011

--

If you think non-graphical email clients are efficient or otherwise desirable, and want offline access to your email, this post describes a step forward. In particular, it describes the set-up of offline-accessible mail through the Alpine (formerly Pine, shortly Realpine) email client under (Ubuntu/Debian) GNU/Linux.

Orientation

Finally, I think we can move beyond the dreaded “maildir patch” problems associated with Pine/Alpine/Realpine since it became fully open-source. I would, ultimately, like to see the setup of alpine / mutt / emacs / etc email clients be as easy as GUI clients, at least for those who want a pretty standard setup. For instance, in my case, I want

  • to have my email accessible locally, ie “offline”, not just because I am sometimes reading it on a bus but because it’s much faster that way;
  • to be able to use fast, keyboard-driven interfaces which nicely integrate my favourite editor into email composition and maybe even navigation;
  • to have an interface that parallels what I get on GMail, since I archive all my email accounts there and still sometimes use GMail’s interface for searching email archives. That is, I want my email client to show my GMail labels (as folders) and to add them to messages and to move messages around, just like GMail does.
  • to be able to switch between email clients when I like, rather than being tied to one by its own storage format.
  • to have the key connections between components be updated at the package level when the underlying daemons etc are updated; for instance, dovecot has changed a couple of times recently, upsetting people’s settings in the offlineimap or alpine configuration. If they are to be seen to work together as a system, the interface between them should ideally be updated automatically.

Overview

The solution is to store mail locally in a Maildir format and to have easy and robust ways for any/each email client to communicate with the local mail repository. That means making public, or offering as pre-fabricated packages, simple setups for the various email clients.

Thanks to Asheesh Laroia, I now have a simple installation that allows alpine to seamlessly use a local IMAP server as a plugin-interface to my email. This makes it easy to swap in or out any other mail client. We aim to bundle a setup of Alpine and Dovecot in order to make this option easy. It is especially useful when combined with Offlineimap, which syncs your local mail repository with whatever is your primary email server. For instance, my setup, used as an example, below, gives me a local, on/off-line Alpine interface to my GMail.

A limitation is that this does not cover the setup for sending messages while offline. Also, the simple setup below includes writing your password as plain text in the offlineimap configuration file.

Setup (start here if you like!):

In the following instructions, replace GMAILUSERNAME with your GMail username or other email service username, and replace NIXUSER with your log-in name on your local machine.

Installing system software (under Ubuntu; requires root access)

Execute the following at a command line:

Dovecot (imapd)

Create a new file, for instance, called ~/.auto-dovecot.conf to contain a customized location for your offline maildir mail repository (this way, we don’t interfere with dovecot’s system-wide configuration file). The contents of the file should be:

--

--

C Barrington-Leigh
The Red Pen

Economist @McGillU, working to understand what subjective well-being can teach us about society, communities & sustainability. Former physicist. Climate hawk.