A brief introduction to mutt-ng

Posted by Steve on Mon 14 May 2007 at 09:57

mutt is a well known and much loved mail client well suited to the efficient handling of a large volume of email. One of the things which makes it so powerful is its extreme flexibility and customisation options. The next-generation mutt package builds upon the core mutt with some additional features; most noticeably the introduction of a sidebar, which this article introduces.

To start with I'll explain how my current installation of mutt is configured. When the mail-client starts it reads and parses the per-user configuration file ~/.muttrc if present.

My current ~/.muttrc file consists of one line :

source ~/.mutt-`test -e ~/.mutt-$(hostname -s) && echo $(hostname -s) || echo global`

That looks pretty scary, but the result is pretty simple though:

  • If the file ~/.mutt-HOSTNAME exists it is read and parsed.
    • Where "HOSTNAME" is the short hostname of the current machine.
  • Otherwise ~/.mutt-global is read and parsed.

This system allows me to store the configuration specific to a number of different hosts within a single CVS tree without having to worry about replacing ~/.muttrc with the correct one on each machine.

The configuration snippet above can be broken down into two parts: The directive "source" which instructs the system to include, and process, another file, and the shell command which is sandwiched between ` (backtick) characters. If you're familiar with shell scripting this should be pretty recognisable to you - if not then don't worry about it!

The reason for introducing this file is to demonstrate how we can conditionally configure mutt to process different files, which is something we'll need later.

Rather than jumping ahead further we'll install the package. For the Etch release of Debian GNU/Linux you'll need to update your sources.list for APT, as the package isn't included in the release proper.

Add the following to your /etc/apt/sources.list file:

#
#  "Experimental" for mutt-ng
#
deb     http://ftp.uk.debian.org/debian/ experimental main non-free contrib
deb-src http://ftp.uk.debian.org/debian/ experimental main non-free contrib

Once you've done that you may update your lists and install the package with your favourite package-manager. I use apt-get, you may use whatever you like:

vain:~# apt-get update && apt-get install mutt-ng

Once the mutt-ng package is installed you can test your current mutt setup with it. The package will load a different configuration file at startup, so you can either copy your ~/.muttrc file to ~/.muttngrc or create a symbolic link:

skx@vain:~$ ln -s ~/.muttrc ~/.muttngrc

Starting up muttng works just fine for me:

skx@vain:~$ muttng

With this setup I can immediately see my messages:

My normal setup

(There might have been errors if some configuration options I'd been using were removed in this package; however that wasn't the case for me.)

To get started using the new features of muttng I'll create a new configuration file ~/.mutt-sidebar with the following contents:

#
# Sidebar basics.
#
set sidebar_width=20
set sidebar_visible=no
set sidebar_delim='|'

#
# color of folders with new mail
#
color sidebar_new  red default

#
# ctrl-n, ctrl-p to navigate to the next/previous mailbox with unread mail.
# ctrl-o to open the selected folder.
#
bind index \CP sidebar-prev-new
bind index \CN sidebar-next-new

bind pager \CP sidebar-prev-new
bind pager \CN sidebar-next-new

bind pager \CO sidebar-open
bind index \CO sidebar-open

#
# Toggle sidebar visibility
#
macro index b 'toggle sidebar_visible'
macro pager b 'toggle sidebar_visible'

As I run mutt upon several systems which will only have the vanilla mutt package installed I must update my configuration file to load this new file conditionally. I can either cause the file to be loaded by adding "source ~/.mutt-sidebar" to ~/.mutt-vain, a host I have, or I can update ~/.muttrc with something like this:

#
#  Load the sidebar configuration file if this host has muttng
#
#  If not just show the version number of mutt on startup - the best
# side-effect free alternative I can think of!
#
`test -x /usr/bin/muttng && echo source .mutt-sidebar || echo "push "`

Either way we'll assume you've configured this appropriately.

Once you've started up your copy of mutt-ng after updating your configuration file you'll be able to press b to view the folder-browser. For me this looks something like this:

The mutt-ng sidebar active

To move the cursor to the next/previous mailbox containing new mail I simply press Ctrl+n, or Ctrl+p. The currently selected folder may be opened, or visited, by pressing Ctrl+o.

It didn't take me very long to get used to this new facility, since finding mailboxes with new mail visually is very simple and navigating amongst them is straight-forward.

Finally I'll sum up by saying that the future of the mutt-ng project looks uncertain. The mutt-ng homepage still exists, but there has been little activity recently. Reassuringly the development blog avows the project is not dead, but it seems like things are unlikely to develop quickly at the moment.

All in all though the additional features added to mutt by the mutt-ng fork seem reasonable and it is to be hoped they'll be accepted into the mainline project in the future.

 

 


Posted by Anonymous (194.112.xx.xx) on Mon 14 May 2007 at 15:57
As the maintainer of the (now-dead) fork called "mutt-ng", I can assure you that the original project is absolutely dead. Mutt-ng now exists as a set of patches, but no efforts are being made that this will be released as separate packages. Due to the general lack of support through the community, I do not have the time nor the interest to continue my efforts, so mutt-ng as it exists now is primarily made for myself (and only rarely updated).

[ Parent | Reply to this comment ]

Posted by Steve (80.68.xx.xx) on Mon 14 May 2007 at 16:52
[ Send Message | View Steve's Scratchpad | View Weblogs ]

Thanks for letting us all know, even if the news isn't good.

Steve

[ Parent | Reply to this comment ]

Posted by Anonymous (85.216.xx.xx) on Tue 15 May 2007 at 09:50
So there had been changes in mutt within the last few weeks and now it is dead? A release of a devel version in april 2007?


cb

[ Parent | Reply to this comment ]

Posted by Anonymous (91.21.xx.xx) on Fri 18 May 2007 at 14:53
He was talking about the mutt-ng project being dead, not the mutt project itself.

[ Parent | Reply to this comment ]

Posted by shufla (83.12.xx.xx) on Tue 15 May 2007 at 15:53
[ Send Message ]

Hello,

Ouch, bad news. I'm going to switch to mutt from Thunderbird/Evolution/KMal, with IMAP accounts and mutt-ng modifications are quite nice.

BTW - is there any possibility to download only message body without attachments from IMAP server? On #mutt answer was 'no', but I do not know if it is possible in IMAP.

Bye,
Luke

[ Parent | Reply to this comment ]

Posted by yarikoptic (69.115.xx.xx) on Thu 17 May 2007 at 05:17
[ Send Message ]

2 Elimar (or whoever was the Anonymous maintainer): that is really sad to see packaging project dying... Is there usually lots of conflicts while applying mutt-ng patchset over vanilla mutt? Myself I love mutt-ng and have switched to it 2 years ago... just now I mentioned that version I have is 1 year old -- I never bothered to check for a new release since the one I have worked fine for me.

My comment: I am a big fan of screen since

1. I never (almost) have to restart mutt(-ng), so getting to my mailbox is as fast as 'ssh mailboxmachine' and running there 'mutt' which is an alias to a screen command

2. I have multiple mutt-ng's running --
1 - main mailbox
2 - imap mailbox -- that is the view with sidebar open, where I can switch from one box to another. this is the only one where I am accessing email via imap since then switch between mailboxes happens faster than when accessing via files (or am I wrong?)
3 - sent mailbox
4 - admin mailbox -- system health emails
5 - spam mailbox
They all are running within the same screen environment which was started using following .screen.mail file:

sessionname MAIL

chdir $HOME/Maildir/down

zombie kr
#
# Mailboxes
#
screen -t Inbox 1 /usr/bin/muttng

setenv ISIMAP .imap
screen -t IMAP  2 /usr/bin/muttng
unsetenv ISIMAP

screen -t Admin 3 /usr/bin/muttng  -f $HOME/Maildir/.Admin
monitor
screen -t Sent  4 /usr/bin/muttng  -f $HOME/Maildir/.Sent
screen -t SPAM  5 /usr/bin/muttng  -f $HOME/Maildir/.Spam


# Main Config
source $HOME/.screenrc
and my aliases in bash are defined as
muttscreen="screen -c $HOME/.screen.mail -A -R MAIL -D"

muttmairix ()
{
 mairix $* && /usr/bin/muttng -f ~/Maildir/mairix_mf/
}

alias muttimap='( $muttscreen -p IMAP )'
alias muttlocal='( $muttscreen -p Inbox )'
alias muttcaught='( $muttscreen -p SPAM )'
alias muttadmin='( $muttscreen -p Admin )'
alias muttsent='( $muttscreen -p Sent )'

alias muttspam=muttcaught

So regardless if I started mutt already, in bash whenever I type 'mutt' I get to the main mailbox, 'muttadmin' in a matter of second brings me into the admin mailbox.

[ Parent | Reply to this comment ]

Posted by daemon (155.232.xx.xx) on Mon 14 May 2007 at 22:15
[ Send Message | View Weblogs ]

It's a shame that this seems to have died, as having a list of mailboxes/folders visible and easily selectable is pretty nice. I was always hoping that elmo would pick up again, as while I never really used it more than giving it the once over, it seemed like it could have been a great app...

I'm in the process of shifting my $HOME user config files to version control (svn rather than cvs in my case), and I got around the .muttrc issue is a different way, but as you showed us your's, I thought I'd tell you about mine ;-)

Rather than have multiple host muttrc versions filling my repository, I have a single svn'd muttrc (actually ends up linked to ~/.mutt/muttrc) which contains a fairly generic collection of options that I like to use, the last line of which is 'souce ~/.mutt/muttrc.local' and any site specific options and overrides sit in that file. As the files get backed up anyway, I figured it was a nice way to do it, as it keeps my svn listing cleaner...

Cheers
:wq

[ Parent | Reply to this comment ]

Posted by Anonymous (213.162.xx.xx) on Tue 15 May 2007 at 16:15
On FreeBSD 6.2 and Debian Etch I haded to replace :

macro index b 'toggle sidebar_visible'
macro index b 'toggle sidebar_visible'
by
macro index b '<enter-command>toggle sidebar_visible<enter>'
macro pager b '<enter-command>toggle sidebar_visible<enter>'

[ Parent | Reply to this comment ]

Posted by Anonymous (213.164.xx.xx) on Wed 16 May 2007 at 09:45
just for info "I had to replace"

[ Parent | Reply to this comment ]

Posted by yarikoptic (165.230.xx.xx) on Wed 23 Jan 2008 at 04:40
[ Send Message ]
just want to mention that there is mutt-patched now which is vanilla mutt with sidebar patch. Unfortunately that patch doesn't have some cute changes (show only with new, custom format, etc) but that is smth which is more/less up-to-date, thus hopefully will be maintained and extended.

[ Parent | Reply to this comment ]

Posted by Steve (82.32.xx.xx) on Sun 2 Mar 2008 at 21:37
[ Send Message | View Steve's Scratchpad | View Weblogs ]

Yes I've switched to using this now, and the missing features are annoying.

Still it is better than no sidebar at all!

Steve

[ Parent | Reply to this comment ]

Sign In

Username:

Password:

[Register|Advanced]

 

Flattr

 

Current Poll

Which init system are you using in Debian?






( 1625 votes ~ 7 comments )