After upgrade to 18.04, Mutt shows raw html when opening html mails in chrome

I use Mutt to read email and most of my email displays just fine as plain text. For the few exceptions I got used to hitting 'v', selecting the html part of the message and then hitting enter to view that message in my browser. To accomplish that, I had a file ~/.mailcap in my home directory with the following entry

text/html; google-chrome '%s'; test=test -n "$DISPLAY"; needsterminal;

I referred to the file from my .muttrc like this

set mailcap_path="~/.mailcap"

Since upgrading to Ubuntu 18.04, this doesn't open a new browser window anymore, but rather shows the raw html code in mutt. After some searching, I learned that I might have to use 'm' instead of the enter key. Indeed that opens the file in a browser, but instead of rendering the html, it displays the message's raw html.

I should mention that I had a similar problem with PDFs, so I assume it's something about Mutt: After the upgrade, PDFs were suddenly shown in acrobat reader, although my mailcap was configured to use zathura. After adding the quotation marks around my mailcap file in my muttrc, mutt displayed raw PDF code when I hit enter and opened the PDF in zathura when I hit 'm'. Yet, the PDF gets rendered, while HTML doesn't.

EDIT I noticed that saving the message manually as message.html allows me to open the message and have it rendered, but saving it as message makes chrome display the source code. So the following mailcap entry does the job (if I hit 'm'):

text/html; mv '%s' '%s'.html && /usr/bin/sensible-browser '%s'.html && sleep 2 && rm -f '%s'.html; test=test -n "$DISPLAY"; needsterminal;

But this is clearly not how it is supposed to be.


What worked for me is using nametemplate=%s.html in my ~/.mailcap like:

#GUI browser if $DISPLAY is set
text/html; /usr/bin/sensible-browser %s; test=test -n "$DISPLAY"; nametemplate=%s.html

See this part of the Mutt FAQ