Use read-only Mutt IMAP for shared and subscribed folders

Mutt MUA for read-only mail

Several thousand apps log their state and mail it to an account. This is quite usual for cron logs, several CMS Update logs, Icinga or Nagios alerts… Personally I do not mix these with customer relations eMail. So I use Mutt as a read-only MUA, taking advantage of its IMAP features. This is only possible with the patches, e.g. for Macports:

sudo port install mutt-devel +imap  +ssl +tokyocabinet +gpgme +compress +gnuregex +headercache +sidebar 

A dotfile


set mbox_type=Maildir

set mbox="~/Maildir"
set record="+.Sent"
set postponed="+.Drafts"
set spoolfile="~/Maildir"

set realname = "Edgar Wild"
set imap_user = 'ewild'

set spoolfile = imaps://
# set smtp_url = "smtp://"
set folder = "imaps://"
set mask=".*"

set imap_check_subscribed = yes

set header_cache="~/.mutt/cache/headers"
set message_cachedir="~/.mutt/cache/bodies"
set certificate_file=~/.mutt/certificates

set sort=threads
set sort_aux=reverse-date-received

# sidebar
set sidebar_visible=yes
set sidebar_width=35
set sidebar_delim='|'

bind index \CP sidebar-prev
bind index \CN sidebar-next
bind index \CO sidebar-open
bind pager \CP sidebar-prev
bind pager \CN sidebar-next
bind pager \CO sidebar-open

color attachment brightmagenta default
color error      brightred    default
color hdrdefault red          default
color indicator  brightyellow red
color markers    brightcyan   default
color message    brightcyan   default
color normal     default      default
color quoted     brightblue   default
color search     default      green
color signature  red          default
color status     yellow       blue
color tilde      magenta      default
color tree       magenta      default

This way you will find your subscribed folders in the sidebar. With Mutt’s IMAP client functions you can use server side searching (to take advantage of Dovecot’s Solr or other full text search engines on an IMAP server).

Offlineimap with notmuch

For certain subscribed read-only IMAP folders, you can use offlineimap with a local retention policy. It’s a sophisticated tool.
In this case it’s 35d and subscribed folders only. You can switch Mutt onto the offlineimap Maildir, or directly search from within notmuch. Notmuch is a Xapian frontend for eMails.
Or Recoll to build source specific sub indexes. Which works on MacOS btw:

Recoll on MacOS

Offlineimap config:

# List of accounts to be synced, separated by a comma.
accounts = main
# i = Curses.Blinkenlights, TTY.TTYUI, Noninteractive.Basic, Noninteractive.Quiet
type = Maildir
sep = .

[Account main]
# Identifier for the local repository; e.g. the maildir to be synced via IMAP.
localrepository = main-local
# Identifier for the remote repository; i.e. the actual IMAP, usually non-local.
remoterepository = main-remote
# Status cache. Default is plain, which eventually becomes huge and slow.
status_backend = sqlite
maxage = 35
subscribedonly = yes

[Repository main-local]
# Currently, offlineimap only supports maildir and IMAP for local repositories.
type = Maildir
# Where should the mail be placed?
localfolders = ~/admins_IMAP

[Repository main-remote]
# Remote repos can be IMAP or Gmail, the latter being a preconfigured IMAP.
type = IMAP
remotehost =
remoteuser = ewild