I have just started using notmuch for email. I was wondering if there is some way I can view the HTML part of an email in an external browser or rendered to a pdf and viewed inside Emacs (like you can do with mu4e)?

1 Answer 1


You can use notmuch-show-view-part (bound to .-v by default) while point is in the text/html part to accomplish this.

For this to function properly you'll need to make sure your ~/.mailcap file has settings for text/html.

Here's what I have in mine on my Mac:

text/html; open %s; nametemplate=%s.html

Each line is ; delimited with the first field specifying the content type, the second field specifying the command to use, and any additional fields specifying options.

So I have nametemplate which essentially adds .html to the filename that notmuch generates, which is then passed to open (which knows how to handle it because of the .html ending).

The format is described in RFC 1524.

As mentioned, you need to be in the text/hmtl part of the email for this to work. Since this can be inconvenient, I use this function which you can call from anywhere in the message in order to open the html part:

(defun notmuch-show-view-html+ ()
  "Open the text/html part of the current message using
       (lambda (value notmuch-part)
         (equal (plist-get notmuch-part :content-type)
  • Thank you! I figured out the mailcap part but your explanation helps! I have set up to view the email in the browser and I am now trying to add a second option to convert the HTML to a PDF file. I have not started figuring this yet but your answer gives me very good directions. Thanks!
    – ajallooe
    Commented Feb 22, 2021 at 0:56
  • Great answer. Do you know if notmuch-show-view-part can also export inline images, or will they always be missing? Commented Mar 9, 2021 at 4:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.