mu4e normally prefers the plain-text version for messages that
consist of both a plain-text and html (rich-text) versions of the
body-text. You can change this by setting
to t. And you can toggle this value (globally) using h in the
message view; this also refreshes the message with the new setting.
Note, when using html-based rendering, you don’t get the hyperlink shortcuts the text-version provides.
If there is only an html-version, or if the plain-text version is too short in comparison with the html part25, mu4e tries to convert the html into plain-text for display.
With emacs 24.4 or newer, this defaults to
uses the built-in shr renderer. For older emacs versions, this
defaults to the built-in
html2text function. In practice, the
latter gives much better results.
If you use
mu4e-shr2text, it might be useful to emulate some of
the shr key bindings, with something like:
(add-hook 'mu4e-view-mode-hook (lambda() ;; try to emulate some of the eww key-bindings (local-set-key (kbd "<tab>") 'shr-next-link) (local-set-key (kbd "<backtab>") 'shr-previous-link)))
If you’re using a dark theme, and the messages are hard to read, it can help to change the luminosity, e.g.:
(setq shr-color-visible-luminance-min 80)
If your emacs does not have shr yet, it can be useful to use a
custom method. For that, you can set the variable
mu4e-html2text-command to either a shell command or a function
mu4e-html2text-command is a shell command, it is expected to
take html from standard input and write plain text in UTF-8 encoding
on standard output.
An example of such a program is the program that is actually called html2text26. After installation, you can set it up with something like the following:
(setq mu4e-html2text-command "html2text -utf8 -width 72")
An alternative to this is the Python python-html2text package; after installing that, you can tell mu4e to use it with something like:
(setq mu4e-html2text-command "html2markdown | grep -v ' _place_holder;'")
On OS X, there is a program called textutil as yet another alternative:
(setq mu4e-html2text-command "textutil -stdin -format html -convert txt -stdout")
mu4e-html2text-command refers to an elisp function, the
function is expected to take a message plist as its input, and returns
the transformed data.
You can easily create your own function, for instance:
(defun my-mu4e-html2text (msg) "My html2text function; shows short message inline, show long messages in some external browser (see `browse-url-generic-program')." (let ((html (or (mu4e-message-field msg :body-html) ""))) (if (> (length html) 20000) (progn (mu4e-action-view-in-browser msg) "[Viewing message in external browser]") (mu4e-shr2text msg)))) (setq mu4e-html2text-command 'my-mu4e-html2text)
this is e.g. for the
case where the text-part is only a short blurb telling you to use the