How to troubleshoot Mutt html preview choking

mutt

For a while now I've found that when I try to view an HTML file in my browser (from Mutt, v to see all attachments, select the text/html attachment and enter) my browser opens a new tab at file:///tmp/mutt.html but consistently says

File not found

Firefox can’t find the file at /tmp/mutt.html.

Check the file name for capitalization or other typing errors.
Check to see if the file was moved, renamed or deleted.

I'm not quite sure how to troubleshoot this. It worked fine until it didn't. And then just to keep me on my toes every 10th or 12th time it randomly does show the HTML mail.

For instance, just now, I …

  • tried to view an HTML email,
  • decided I want to finally troubleshoot this,
  • started composing the first 2/3 of this question,
  • opened a second terminal tab to look at /var/log/ to see if there's an obvious log file to look at
  • ran tail -f /var/log/syslog
  • with tail follow running, went back to try viewing the HTML email again, just to see if anything is written to syslog (though I don't think it would be) and a) nothing was written to syslog, b) the same exact email actually did open just fine in a browser tab.

So … where should I be looking for some indication of why mutt html messages sometimes open just fine in a browser and sometimes /tmp/mutt.html can't be found?

Best Answer

I had some trouble with that too. The mailcap entry for text/html is the point to look at. With chromium it was indeed the needsterminal flag. For firefox the copiousoutput flag did the trick.

#text/html; chromium %s; needsterminal
text/html; firefox %s;copiousoutput 

If you don't already have a custom mailcap, you can create a file at ~/.mailcap for example and add the firefox line to it. Don't forget to specify the path in your .muttrc

set mailcap_path  = ~/.mailcap