Display HTML Mail in Mutt

The second most annoying thing using a command line e-mail client like mutt is HTML mail.

some of my spam

The most annoying is of course spam, but this is a topic for later. A neat feature of mutt is to use a command line browser to render the HTML. This is still far from ideal, but at least it renders a readable mail.

rendered html spam

To do this you need to put the following in your ~/.muttrc

alternative_order text/plain text text/html #prefer plaintext over dumped html
auto_view text/html     # load html emails with links (config in ~/.mailcap)

This will tell mutt to prefer displaying the plaintext variant (if there is one) of a mail. It also tells mutt to render HTML via an application that we yet have to define in ~/.mailcap

text/html; links -dump %s; nametemplate=%s.html; copiousoutput

This will call the links command line browser to render the content.

Installing links is easy, too:

% doas pkg_add links

Et voila, now you can enjoy you spam in rendered HTML…