Using w3m with gnus

Volume 14, Issue 8; 10 Mar 2011

I succeeded in getting w3m setup to read HTML email in Gnus. Several folks asked me to explain how, so here's my attempt.

Cursing the rising tide of HTML email seems to have little effect. Even among my colleagues whom I think ought to know better, it's all too frequent. For years I've been looking at only the text/plain alternatives when they were provided and washing away the markup when they weren't. Only a spectacularly small number of messages are improved by spraying fonts and colors and whatnot across them.

That said, the occasional message crosses my desk where there are screenshots or other images that I need to see and that I might even find useful to see in context. Shelling out to ripmime and then opening up the images separately is…inconvenient. EmacsOf course I read email in Emacs. Like anything else could even come close. can display them, of course, but that means doing a better job with HTML email in Gnus.

So I asked about it. Among the suggested answers was emacs-w3m which I'd heard suggested before so I spent a few minutes getting it in place. Several folks followed-up in email and other places asking for an explanation of how I got it working. So here it is.

FWIW, I'm doing this on Emacs 23.2.1 on a Mac OS X box. YMMV.

Step 1, I think, is to get w3m working. I got lucky and found it under brew. You might find it under your package manager too. If not, use the source!

Next, I grabbed emacs-w3m from and built it with the usual ./configure dance.

Finally, I added these lines to my ~/.gnus file:

(setq gnus-mime-display-multipart-related-as-mixed nil)
(setq mm-text-html-renderer 'w3m)
(setq mm-inline-text-html-with-images t)
(setq mm-inline-text-html-with-w3m-keymap nil)
(require 'w3m-e21)
(provide 'w3m-e23) ;; hack

I suspect that if that was all it took, fewer people would have asked for the explanation, but that's all I've got record or recollection of doing.

If you get stuck, feel free to ask, though I can't promise anything.


I just take the soft option and forward such mails to my GMail account, which otherwise I scarcely use.

—Posted by John Cowan on 11 Mar 2011 @ 04:17 UTC #

I can use a webmailer to look into the IMAP folders. The SPAN filters and my procmail rules help me to remove like 90% of the messages within that webmailer.

Because you never know, who started with HTML e-mail recently (and most business e-mail seems to be in HTML nowadays), I usually have a short glance at the message within the webmailer. I can do that on almost any machine, not necessarily one of mine. Viewing HTML messages within a true browser is far superior to watching HTML messages within an emacs mode. If it's e-mail worth storing (and/or answering) on my main e-mail machine, I move the message to a dedicated IMAP folder, from which fetchmail will download it within 10 minutes to my own machine. Of course I can always trigger the download ad-hoc. On my own machine a read and write e-mail in emacs using gnus.

—Posted by Jochen Hayek on 16 Apr 2011 @ 05:16 UTC #