Mutt releases version 2.0
The venerable email client Mutt has just reached version 2.0. Mutt is different from the type of client that has come to dominate the email landscape—for one thing, it has no graphical interface. It has a long history that is worth a bit of a look, as are its feature set and extensive customizability. Version 2.0 brings several enhancements to Mutt's interface, configurability, and convenience, as well. In this article, readers who are unfamiliar with Mutt will learn about a different way to deal with the daily chore of wrangling their inboxes, while Mutt experts may discover some new sides to an old friend.
What is Mutt?
Mutt is an open-source (Gitlab repository), GPL-licensed email client that runs in a terminal. When it was first released as Mutt 1.0 in October 1999, it adhered to the Unix philosophy of doing one thing well: being a mail user agent (MUA). Therefore it did not include an editor, image viewer, or an HTML renderer, farming these functions out to external programs. It did include POP and IMAP support, so that it could retrieve mail, but it did not deliver mail over the internet, handing that job to a locally-installed mail submission agent (MSA) instead.
Most email clients perform additional functions in addition to their roles as MUAs. Programs such as Thunderbird or the commercial offerings for macOS and Windows incorporate editors, viewers for attachments, address books, and can directly speak simple mail transfer protocol (SMTP). They often include even more, such as task management or calendering. The widely-used Gmail service is a web application that automatically assumes all of the media display features of the browser and is closely integrated with many of Google's other services.
Mutt retained its tight focus for many years, but made one major compromise in April 2007. With v.1.5.15, Mutt could deliver email using the SMTP protocol. No longer would users need to have a local copy of Sendmail or Postfix installed, because now Mutt could authenticate with and communicate to their ISPs directly in order to send email.
Mutt was written by Michael Elkins in 1995 with an interface inspired by
Elm, incorporating features from Pine and
Mush, resulting
in a mixed breed, hence the name. Mutt has an official slogan: "All mail
clients suck. This one just sucks less.
"
Why use Mutt?
Mutt has two main advantages: efficiency and configurability. It appeals to those who spend hours tuning their .vimrc files (mea maxima culpa) and who demand that their programs start up and respond instantly.
Mutt is extremely configurable in the way that it presents information and in its command interface. In order to take advantage of this, the user must become familiar with the basics of Mutt's pattern language, which is set of codes that refer to properties of messages. All the details about this are in Mutt's exhaustive manual; in this article I'll provide some examples, to give a bit of flavor of what it is like to work with Mutt.
There are two main places where Mutt presents information: the index is the list of messages, and the pager shows the contents of a message. Upon startup, the user sees the index; when a message is selected for viewing, the window is split: a small portion on top to see the index entry of the message with some context, and a larger portion with the email.
The following screen shot shows Mutt with one message selected for viewing. The colors of each email header, as well as each level of quoting, can be specified in the startup file. The screen shot shows the command reminder on the top line, with the index pane beneath it. This has the "cursor", indicated by black text on a cyan background, on message four, which is the message displayed in the large pane at the bottom.
One of Mutt's unusual strengths is that it actually displays message threads correctly. When people complain that they have trouble following email conversations involving groups of people, what they typically mean is that they are using a client such as Gmail that does not properly display the reply structure of email messages. When an email user hits the reply key, an In-Reply-To header should be added to the email. Mutt refers to these headers, and to the related References header, to keep track of which messages replied to what, and builds a tree to show the structure of the conversation. Some other mail clients attempt to construct this tree using only the Subject header, which can wind up joining unrelated messages and incorrectly breaking a thread when a respondent alters the subject of a reply.
Here is a screen shot of the same inbox, with a little conversation about a performance review added. Mutt displays a visual representation of the conversation tree in the index, showing which messages reply to which, even when participants change the Subject line. Message six is a reply from the CEO to the boss's first email, for example. In message seven I'm writing to someone else about my performance review, in a new message, so it's not part of the tree.
After importing this group of messages into my Gmail account, here is what I see:
I have activated the "Conversation view" setting, which is supposed to group messages into conversations. But Gmail fails to do this correctly. It has created two pairs of related messages, shown by the numeral "2", requiring the user to click on those lines to see the individual messages. But it has lost the thread of all the other messages, displaying them as unrelated. I have dwelt on this comparative example at some length because it is a good answer to the question in the heading: Mutt's conversation threading is sufficient reason for some to stick with it in preference to more "modern" clients. And perhaps a third quality, "correctness", should be added to efficiency and configurability strengths.
Mutt goes beyond simply displaying the conversation tree, also allowing the user to edit it. There are commands to detach a message from the conversation or mark a message as being a reply to another message. This is helpful because some messages will come from correspondents who are using clients that fail to set the Reply-To header, and others will commit the offense of "thread hijacking," often seen in mailing lists, where a user replies to a message with something that is not an actual reply, but the beginning of a new topic.
The user can configure the colors of lines in the index based on almost any property of the message, including its origin, subject, and status (replied to, read, unread, marked, etc.), or even depending on the contents of the message body. Effective use of Mutt's coloring requires a terminal with 256-color support. For fine-grained control over colors, I find it best to use the terminal color codes. Here is an example of a coloring command; it uses the pattern ~F to indicate a message that has been "flagged", or marked as important:
color index color124 color234 ~F
If this line is present in Mutt's startup file, .muttrc in the user's home directory, then lines in the index for flagged messages will appear with red (color124) text on a nearly black (color234) background.
Colors can also be controlled by a scoring system, where points can be added to or subtracted from a message based on header criteria, and a color assigned based on the total score. For example, these configuration commands:
score '~f boss' +10 score '~s meeting' -5 score '~s party' +20 color index color208 color234 "~n 10" color index black red "~n 20" color index magenta black "~n 5"
give email from the boss (~f boss) a ten point bonus, but any message with "meeting" in the subject line (~s meeting) gets knocked down by five points. Really important emails, about parties, get a 20 point boost. The last three commands set colors in the index, based on the message scoring, and using both color names and numbers; the text color comes first in each command, followed by the background color.
Here is the result:
The last row, with the default black text on a cyan background, shows the position of the cursor.
Mutt puts a lot of expressive power in the user's fingertips. Its pattern language can be used to construct searches using any property of the messages. For example, after pressing "/" to enter the search prompt, the command:
~fboss~d<2d~smeeting
searches for emails from boss, less than two days old, about meetings, placing the cursor on the first message found. Hitting "n" takes the user to subsequent matches. The same commands entered after typing "l" limit the index display to messages satisfying the criteria, giving the user a filtered view of their mailbox; messages not matching the search criteria are temporarily hidden.
In addition to manually entered commands, hooks can be defined in Mutt's startup file that are executed before taking certain actions. A hook can be set to to run before replying to a specific user, when changing mailboxes or accounts, when editing an email, and more. The user can also define macros, binding arbitrary sequences of commands to single keystrokes, and these bindings can have different meanings in different contexts; a keystroke can do one thing while reading an email, something else when looking at the mailbox index, and a third thing when viewing a message's attachment index.
In addition to Mutt's two main information panes, Mutt has an attachment pane, shown in the next figure, to display an index of the attachments for a particular message. Here the user can view, delete, save, pipe to a shell command, and do other things to attachments individually or in groups. When "viewing" an attachment, Mutt will refer to the user's .mailcap file, or, if that doesn't exist, to the system-wide one, to find out which program—or, in fact, shell pipeline—to use to handle it.
Mutt can also be instructed to automatically convert some attachment types to text for direct viewing in the pager. This is most commonly done in order to read HTML email using programs such as w3m or Lynx. If the text view is not enough, a couple of keystrokes pops the attachment over to the user's graphical browser. Mutt is also designed to work with OpenPGP to sign and encrypt email, which will become a useful feature when people decide to use encryption.
In addition to its curses-based interface, Mutt can be used from the command line for batch processing of email. Here is the command to send an email to the boss with a subject of "Performance review", a PDF file as an attachment, and using the contents of the file reviewComments.txt as the message body:
mutt -s "Performance review" boss@bigco.xyz -a signedreview.pdf < reviewComments.txt
Mutt's remarkable efficiency can change one's approach to email. The program can start up and present a properly sorted and threaded index of thousands of emails in under a second. Searching and filtering are effortless and practically instantaneous. For these reasons, I don't bother maintaining separate mailboxes; there is no need to decide how email should be organized, as I can create any view into my inbox to serve the needs of the moment, on the fly. Instead of "inbox zero", my guideline is "inbox 10,000", because that is the point where Mutt may take longer than two seconds to open my mailbox. At that point, with just a few keystrokes I can archive, say, the oldest non-flagged 5,000 messages, an operation that is also nearly instantaneous.
For some, Mutt's advantages will not outweigh what they consider to be its inconveniences. The chief one of these is its lack of integrated HTML rendering, made more acute by the current preponderance of HTML email. Although Mutt handles HTML attachments as described above, there are those who dislike switching to another program, and prefer everything to be included. Such users may also prefer programs with integrated calendaring, task management, GUI message composition, spam detection, auto-replies, and other features that will likely never be part of Mutt, as they are alien to its MUA-focused nature. However, these users could consider enhancing Mutt with some of the wide variety of patches and add-ons available.
New in 2.0
Version 2.0 of Mutt was released on November 7, 2020. There are a few minor incompatibilities with previous releases, which means that existing startup files may not work, or may work differently. These incompatibilities are the reason for the major version bump to 2, although, as one data point, my existing setup worked without change. The new version introduces a few new features that make Mutt even easier to work with.
Those who want the new version now will probably need to download the source and compile it, except for users of distributions such as Arch that already incorporate the new release. Compiling is quick and there are no unusual dependencies.
The screen shots above illustrate the default background and foreground colors for the "indicator", showing where the cursor is in the index. Of course any colors can be chosen for this purpose, but in versions before 2.0 those colors replaced the user's carefully chosen colors for showing the status and properties of the message. I've always found this annoying, and, apparently, I was not alone, because in the new version the cursor can be made less obtrusive. The following figure shows the mailbox in the first figure again, but now using Mutt 2.0 with the indicator set to be an underline and the new option set cursor_overlay added to the startup file. In the figure, the cursor is on the first message, but the color can still be seen:
It may seem like a small thing, but an email program is something that is used all day long much of the time, so any improvement that makes it easier to see what is going on is most welcome.
Another interesting addition is something the developers are calling "MuttLisp". This is not a full-blown language like Emacs Lisp, but an enhancement to the configuration syntax, allowing the use of S-expressions for making settings based on conditions, and constructing commands by manipulating strings. Users are warned that this feature is experimental and the details are expected to change in future releases.
In version 2.0, the user can get a reminder of the 46 possible things in the pattern language that can follow a "~" when entering a search or limit command, by hitting the TAB key. Mutt users can also now address mail directly to IPv6 addresses, such as:
To: toaster@[IPv6:ffbc:b47:ba4f:94ed:4425:492:d948:8aee]
This may be useful in communicating with Internet of Things devices.
Another enhancement in the latest version will be welcomed by those whose IMAP connection may not always be reliable. Now Mutt will automatically attempt to reconnect if the connection drops or if the server stops responding. The other additions in version 2.0 are nearly all additional configuration parameters whose description would take us pretty far into technical Mutt minutiae.
Getting started
It can be a little daunting to get started with Mutt. The manual is a great place to look things up when you're already familiar with the program; it is complete to a fault. But it is full of terms and ideas used without explanation. Fortunately, many helpful articles about Mutt have been written over its long lifetime, including this getting-started guide. Two others, "A Quick Guide to Mutt" and this Linux Journal article are a bit older, but still useful. When getting started, it may be helpful to have examples of other users' configurations; there is a list of those here. There are mailing lists, including mutt-users where pleas for help are welcome, as well as others for announcements and for developers.
When I was learning Mutt some decades ago I discovered that it allowed me to freely edit message headers, and of course I immediately amused myself by sending off several emails to friends from "God@heaven.com" and Santa Claus. Today, although I've mostly gotten over this phase, I still routinely do things in Mutt that cannot be done in other email clients, such as Gmail, because there are no commands to do them. Mutt is one of those power tools that demand a significant investment from the user to learn its ways and to get it set up and configured. For some of us, who "live in email," this investment pays off handsomely—but it's certainly not for everyone.
Index entries for this article | |
---|---|
GuestArticles | Phillips, Lee |
Posted Nov 25, 2020 15:11 UTC (Wed)
by mageta (subscriber, #89696)
[Link] (2 responses)
Posted Nov 25, 2020 15:43 UTC (Wed)
by zdzichu (subscriber, #17118)
[Link] (1 responses)
Sure, you can color according to regexes. My .muttrc contains something like this: which seems like a good starting point for customization.
Posted Nov 25, 2020 16:19 UTC (Wed)
by mageta (subscriber, #89696)
[Link]
Posted Nov 25, 2020 17:09 UTC (Wed)
by Liskni_si (guest, #91943)
[Link] (7 responses)
(To be honest, I was quite surprised to not see a mention of neomutt in the article.)
Posted Nov 25, 2020 17:21 UTC (Wed)
by leephillips (subscriber, #100450)
[Link]
Posted Nov 25, 2020 17:41 UTC (Wed)
by mageta (subscriber, #89696)
[Link] (1 responses)
Posted Nov 25, 2020 18:05 UTC (Wed)
by Liskni_si (guest, #91943)
[Link]
Posted Nov 25, 2020 22:10 UTC (Wed)
by Sesse (subscriber, #53779)
[Link] (3 responses)
It would be really nice to have better HTML support, indeed. And a way to undo my last tab (jump to next unread) keypress, for those times when I accidentally skipped an email :-)
Posted Nov 25, 2020 22:19 UTC (Wed)
by leephillips (subscriber, #100450)
[Link]
Posted Nov 26, 2020 12:10 UTC (Thu)
by Liskni_si (guest, #91943)
[Link] (1 responses)
This is what is looks like: https://twitter.com/Liskni_si/status/1331929691377328129
Posted Nov 26, 2020 13:50 UTC (Thu)
by geert (subscriber, #98403)
[Link]
Posted Nov 25, 2020 18:07 UTC (Wed)
by dullfire (guest, #111432)
[Link] (9 responses)
However I am curious: what do people use for scheduling/calendars in conjunction with mutt (it sounds like mutt itself would offload that to something else)?
Posted Nov 25, 2020 18:25 UTC (Wed)
by dskoll (subscriber, #1630)
[Link] (2 responses)
I use something I wrote: Remind.
However, this is a personal calendar tool, not a group scheduling tool, so it's not a replacement for corporate calendaring tools. Remind is also very idiosyncratic and not to everyone's taste; it is not a dead-simple end-user calendar.
I do slurp both my work and personal Google calendars into Remind using an ICal-to-Remind converter so I can have everything in one place.
Posted Nov 25, 2020 18:30 UTC (Wed)
by leephillips (subscriber, #100450)
[Link]
Posted Nov 26, 2020 3:37 UTC (Thu)
by felixfix (subscriber, #242)
[Link]
I don't even try to track work calendars in remind. That uses whatever work supplies, which has never been particularly reliable, and that's fine with me -- keeps people reluctant to schedule things for me :-)
Posted Nov 25, 2020 23:50 UTC (Wed)
by mathstuf (subscriber, #69389)
[Link] (3 responses)
- vdirsyncer for syncing
For importing events, I save the ical and `khal import` it. One could probably set up `.mailmap` to do this less manually though. Note that all of the latter support local-only accounts (as I keep as a short task list for work items in `todoman`.
On the phone:
- DAVx⁵
Posted Dec 10, 2020 23:39 UTC (Thu)
by emorrp1 (guest, #99512)
[Link]
I think I can help you with that, especially if you also have notmuch or a gpg keyring, I recommend using "lbdb":
# ~/.muttrc
# ~/.lbdb/rc
# ~/.lbdb/m_notmuch
Posted Dec 13, 2020 14:28 UTC (Sun)
by jspricke (guest, #123988)
[Link] (1 responses)
I have written a plugin for Radicale to serve Remind data through CalDAV:
And also command line tools to convert between icalendar and remind (to pipe ics attachments to, for example):
Posted Dec 15, 2020 21:49 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link]
Posted Nov 26, 2020 3:36 UTC (Thu)
by unixbhaskar (guest, #44758)
[Link]
Posted Nov 26, 2020 3:38 UTC (Thu)
by unixbhaskar (guest, #44758)
[Link]
Posted Nov 25, 2020 18:11 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link] (1 responses)
Posted Nov 25, 2020 23:51 UTC (Wed)
by mathstuf (subscriber, #69389)
[Link]
Posted Nov 25, 2020 22:49 UTC (Wed)
by mgedmin (subscriber, #34497)
[Link] (1 responses)
Posted Nov 25, 2020 22:56 UTC (Wed)
by leephillips (subscriber, #100450)
[Link]
Posted Nov 26, 2020 1:46 UTC (Thu)
by gus3 (guest, #61103)
[Link]
Yes, that one word. He looked at my screen, listened as I explained why I liked Pine (I'd still like to use it) and then... he just said it, made eye contact, and then smiled and walked away from my cubicle. And even though I have never tried it, I hold it in a high regard, based on his greatly understated recommendation to me.
I've read bits (of documentation) about it over the years, and it impresses me as something "on the other team." As in, I'm a vi user, but I admire what emacs has to offer. So I'm also a Pine/Alpine user, but I see why mutt users like to use it.
Posted Nov 27, 2020 8:18 UTC (Fri)
by Yenya (subscriber, #52846)
[Link] (3 responses)
Posted Nov 27, 2020 13:53 UTC (Fri)
by leephillips (subscriber, #100450)
[Link] (2 responses)
Posted Nov 29, 2020 12:41 UTC (Sun)
by Yenya (subscriber, #52846)
[Link] (1 responses)
Posted Nov 29, 2020 14:26 UTC (Sun)
by mathstuf (subscriber, #69389)
[Link]
[1] https://gitlab.com/muttmua/mutt/-/blob/21ebc162211eb0903a...
Posted Dec 3, 2020 10:54 UTC (Thu)
by flussence (guest, #85566)
[Link]
Mutt releases version 2.0
Mutt releases version 2.0
color body cyan default "^\\\+[^\\\+]{2}.*$/?"
color body red default "^\-.*$"
color body brightgreen default "^\\\+\\\+\\\+ .*$"
color body brightgreen default "^\-\-\- .*$"
Mutt releases version 2.0
Probably could've come up with that myself if I had invested a bit more time in reading the manual.
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
My setup: https://github.com/liskin/dotfiles/commit/b40b57dbccf14cb..., https://github.com/liskin/dotfiles/commit/db41108770ea921..., https://github.com/liskin/dotfiles/commit/347e2f910e43dcc..., https://github.com/liskin/dotfiles/commit/afd67a20bde3d81..., https://github.com/liskin/dotfiles/commit/6d0bff9b8f5736d...
Mutt releases version 2.0
How could I have predicted HTML emails would become a reality and an annoyance soon?...
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
- khal for calendars
- todoman (I used to use taskwarrior and switched for similar reasons as remind) for tasks
- khard for contacts, though its mutt integration seem to have regressed
- Etar
- Tasks.org
- Stock Contacts app
Mutt releases version 2.0
set query_command = "lbdbq %s"
MODULES_PATH="$MODULES_PATH $HOME/.lbdb"
METHODS="$METHODS m_notmuch m_khard m_gpg"
SORT_OUTPUT=false
PASSWD_IGNORESYS=true
# https://gist.github.com/edigiacomo/aad4894da9a2f5a6ba078a...
Mutt releases version 2.0
https://github.com/jspricke/radicale-remind so you can connect with DAVx⁵.
https://github.com/jspricke/python-remind
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Well, it doesn't.
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0
Mutt releases version 2.0