Mutt: Viewing Attachments / HTML via .mailcap and a Custom Fortune as a Signature in Mutt

It’s funny how small, trivial things can lead you to make radical changes in the tools you use. As regular readers of this blog know, I collect sayings that I publish every month. I then compile these sayings into a custom fortune file that displays one saying every time I login to my computer or open a new terminal window/shell process.

I recently learned that I can call this custom fortune file as a signature and have one added automatically to every email I write by adding this line to my .muttrc configuration file.

set signature="fortune /usr/share/games/fortunes/cafebedouin -s|"

This is simply calling the fortune program, specifying the location of the file and the -s flag is telling fortune to find a small quote to add. This is a completely trivial feature, but I love it. It is what provided the motivation to actually get mutt to work as my main email client.

My main problem with mutt has been that I couldn’t figure out how to get it to render HTML emails in a readable format, which makes mutt a poor choice as an everyday email client. Half of the emails I receive are in HTML format. The problem, it turns out, is that my email provider encrypts all my email, so I needed an additional line in .mailcap that processes the pgp/mime format, like so:

text/plain; cat %s; copiousoutput
text/html; mkdir -p /tmp/mutt \; cp %s /tmp/mutt \; firefox /tmp/mutt/$(basename %s) &
text/html; lynx -nonumbers -dump %s; copiousoutput; nametemplate=%s.html 
pgp/mime; lynx -dump %s; copiousoutput; nametemplate=%s.html

This points to something I didn’t understand. .mailcap is basically how you tell mutt to process email attachments, and you simply associate file types with programs on your system. There’s also default behavior, where the text/html with copiousoutput will be used when you hit enter by default and when you go to view the attachment, mutt will call the first relevant line in mailcap, as mentioned here.. The same idea applies to other file types, such as images.

image/*; mkdir -p /tmp/mutt \; cp %s /tmp/mutt \; xdg-open /tmp/mutt/$(basename %s) &

So, once the change above is made, you then need to change this line in .muttrc:

alternative_order text/html text/plain text/enriched text multipart/alternative 
auto_view text/html

# Removes temporary attachment files
folder-hook . `rm -f /tmp/mutt/*`

And now, it works beautifully. I’ve completely stopped using thunderbird, and I only use mutt. And, it has improved my email experience so much. I receive something like 50-100 emails a day, most of them newsletters or promotional material from organizations I signed up to hear more about. But, mutt makes it so easy to navigate and delete email.

Since making the transition, my inbox – which I had always relatively good control over and rarely had more than a day’s worth of email in – is down to a couple of leftover emails per day. I read what I want and delete them. I highly recommend making the transition.

6 thoughts on “Mutt: Viewing Attachments / HTML via .mailcap and a Custom Fortune as a Signature in Mutt

  1. The assembly line might be a better example (alert: semantic digression) of a technology or technique rather than a tool. Your point that wise tool selection is important, as shown in your Amish example, I will grant uncontroversially. The examples I cited are purposely on the boundary between tool and objet d’art precisely because they invite fetishization of the tool — especially if they’re buried in sand for a couple thousand years and uncovered. That’s the implicit warning I will now make more manifest: fetishization of our tools leads away from humanistic values. The obvious example already well instantiated in modern life is Mammon (money being as much technology as tool is clear, especially with so many versions vying for supremacy). That’s why the example that ought to offend everyone not a hundi-billionaire is space tourism — not on any boundary but instead waaay over the line.

    BTW, so long as we’re not rancorous, disagreement is fine. No need to exit a comments thread so early.

    1. Just busy, most days I’m up for it. Not so much the next few days. I’ll think on it, and get back to this if I have anything interesting (by my reckoning) to say.

  2. Not having learned any of the back-end scripting, coding, and optimization needed to tweak applications to my liking, I’m pretty much limited to the discomforts of off-the-shelf software and basic installations. But I also don’t want to wallow in technical minutia that gives rise to the device paradigm. Plenty of others devote their attentions to that style of thinking, which by my lights warps one’s mind in a peculiar though widespread fashion.

    1. In my view, there’s two computing revolutions going on, and one counter-revolution. The idea of the two computer revolutions comes from Kieran Healy, I’ll quote:

      “There are two computer revolutions. One revolution is trying to abstract out the technology and present people with an easy, touch interface to accomplish specific tasks. Using your phone to take a picture, send a text message, post to social media, play YouTube videos, etc. are all examples of this type of technology. It’s probably the dominant form of computing now.

      The other revolution are the complex computing tools that are being developed that cannot be used via a touch interface.”[1]

      And I think there is a counter-revolution happening around touch computing, where people hate the feudal Internet and are trying to return to simple, text-based tools. For example, the Gemini protocol abstracts out a lot of the complicated features of HTML and makes creating a webpage for the protocol about as easy as writing an email.[2] It uses markdown.

      My aesthetic of late is to try to see how much of my use of the computer I can get back to the command line. So, this is in line with simple, text-based tools. It’s possible to configure and use many of them with standard configuration files. But, these simple tools also have complexity, and you can down as far as you want down that road.

      For example, I published this post from emacs using org2blog because emacs is an editor than can be used from the command line. But, emacs is not for everyone. As the saying goes, what’s good for the old monk isn’t necessarily good for the novice. Even among old monks, many don’t like emacs.

      I’d like to see more diversity. Even simple things like using a email client on your computer and not using a feudal internet web-based email can make a huge difference in your experience of email. I know people that wait minutes for their email to load in a web browser. It generally take seconds with an email client, and even less with a text-based program like mutt. Since it doesn’t require a mouse and clicking around, it is easy to read, delete, save and so forth, all with press of a key.

      In the end, it’s about choice. And, there’s degrees of choice everywhere. Even in *nixes, there’s a huge difference between a popular Linux distribution like Ubuntu, a distribution where you selected most of your packages like Arch, and something like OpenBSD. They all have different use cases, and I like the variety. But, options means you are going to have to make choices and configure the software.

      Other people prefer the walled garden, where the only buy Apple products because everything “Just Works”. Well, of course until it doesn’t. I always find Apple products annoying because they don’t follow standards and have their unique snowflake method of doing things, e.g., AirDrop instead of bluetooth, FaceTime instead of a cross-platform video call app, etc.

      But, even that is a choice. You’re welcome to it, if that’s your jam. But, I think life is far more interesting when we make the effort to choose something other than the default option. That’s true of computers, and much else in life.

      But, your point is also a good one. It’s possible to get lost in the noodling around with settings and bury yourself in technical minutia, as is evidenced in a post like this one. But, on the other side of that, I generally only have to solve problems like these once. Then, I make a post about it, and when I have to configure mutt again. I just look up my previous solutions. If anyone else finds them helpful, well, that’s a bonus.


      1. Seems I touched on a favorite topic of yours. Without investigating your links, it seems you’re offering different versions of the technological sublime. While others might find beauty in their tools — the perfectly balanced whalebone knife, the curved HDTV screen, the Corvette Stingray, or the hundi-billionaire’s multibilliiion-dollar joyride into a 10-minute low-Earth orbit, say — these are false, anti-humanistic values. No doubt a deep sociological argument can be made in several directions, but beyond its ability to get things done, a bejeweled or rusted old hammer is still just a thing to whack other things with.

      2. The road to homo sapien goes through homo habilis. Choice of tools shape the man, the society and the world. You choose to focus on tools of luxury, but the assembly line is probably the better reference point. That’s an embodiment of a “tool” with anti-humanistic values because it turns people into machines. Just another hammer? I don’t think so.

        Technological parallels abound. I don’t think you get to humanistic values in our landscape, without very thoughtful consideration of the tools you use and the values they embody. Not a popular opinion, but hey, “that’s what it means to be Amish.”[1] I think I can leave it here, comfortable agreeing to disagree. We belong to different points of view, and I’m not interested in proselytizing (or being proselytized to).


Comments are closed.