Mutt Configuration Notes

I recall there were some posts a while back — somebody complaining about there not being enough technical content in geminispace. Or was it too much? I can't remember. Anyway, here are some notes on Mutt configuration.

One of the great things about Mutt is that is can be configured, customized, and reprogrammed with much the same depth and flexibility as you get with other free software packages like Emacs. With Mutt, you don't get a full-fledged lisp environment to write programs on top of it, like in Emacs. But it does have variables, functions, hooks, and programmable keyboard macros. It also has something called "MuttLisp" but it has less than a dozen words, not including any of the usual lisp primitives you would expect for writing programs or building syntax.

The tradeoff is that things are not necessarily set up "out of the box" the way you might expect coming from Gnome Evolution or another pop e-mail client. Here are some things I had to mine out of the info manual over a day or three:

Secure IMAP/SMTP password storage

The manual warns you against putting your IMAP/SMTP password(s) in cleartext in your configuration file, which makes sense, but the alternative isn't obvious. The approach I took was to store the password (the same for both) in the external "pass" program. The Mutt configuration system allows you to use bash-style command substitution with backticks, so something like this is easy:

See PASS(1) for information on adding the password(s) to pass.

Different signatures for replys

I wanted to use a shorter signature when responding to e-mails, vs. a longer signature otherwise. For this, you just need to create two signature files, and then include

My preferred color scheme

This binds Control-b to launch urlscan, an external program.

Archive and delete

I use this little macro to Archive stuff quickly. Upon pressing Control-a, it copies the e-mail to the =Archive folder, and then marks the e-mail for deletion.

Forward messages as MIME attachments

Personally, I like MIME forwarding much better than inline.

Composing e-mails in Emacs

First of all, you want to add (server-start) to your emacs init file, and become familiar with EMACSCLIENT(1).

Next, add this to your .muttrc:

Then, when you go to compose a new e-mail (properly speaking, edit the message content) a new emacs frame will pop up immediately, for writing the message. But it will use emacs-server rather than having to load a new emacs instance, which can be a lot slower.

In my DE (Gnome) the new frame is small on the screen, so I added the following to my emacs init file, to cause new frames to start out maximized.

Backgrounding and editing session

By default, if you start an e-mail editing session in Emacs, than mutt will pause until the session is done. This is inconvient when you need to lookup something else in another e-mail before you have finished your session. You just need to add this to your .muttrc:

Then mutt will, when it pauses, give you the option of pressing a key to background the session (which does not close your external editor), and also resuming backgrounded sessiosn with the <background-compose-menu> function (bound by default to 'B).

Aliases in a separate file

With the default settings, your e-mail aliases (i.e., address book) will be tacked on to the end of your .muttrc. Instead, move them over to a separate file at "~/.mail_aliases" and then add this to your .muttrc:

Different sorting for different folders

I like to have my =Archive folder reverse sorted, but my =Inbox sorted normally. Folder-hooks to the rescue.

See the info manual for more options.

Show x-mailer header

It is sometimes possible to see what e-mail program was used to send an e-mail. To make this visible by default:


I like to enable autocrypt headers, though to be honest I don't know if I'll ever meet anybody else using them.

Proxied content from gemini://

Gemini request details:

Original URL
Status code
Proxied by

Be advised that no attempt was made to verify the remote SSL certificate.