Reading HTML email with Mutt
Posted by Steve on Mon 10 Jan 2005 at 15:13
Mutt is a console based mail client which can connect to IMAP, or POP3 mail servers. It can also read and write to local mailboxes. For a console client it's very sophisticated, allowing you to customize your setup enormously. One thing that it lacks by default is the ability to read HTML emails though.
If you wish to view HTML mails inside the mutt user interface you'll need to make two changes.
First of all you setup a mailcap file which will automatically dump the HTML text to a readable text-only display, via lynx, links, or w3m. Then you need to tell Mutt that it should do this automatically for all HTML files.
Save the following in a file called ".mailcap" in your home directory. If you already have such a file just add it to the end:
text/html; links %s; nametemplate=%s.html text/html; links -dump %s; nametemplate=%s.html; copiousoutput
If you prefer a different program to render your HTML you can change the links command to that instead - for example w3m, or lynx.
Now we tell mutt that it should automatcally view the text/html parts of message by adding the following to the .muttrc file in our home directory:
auto_view text/html
These two changes should be enough to make sure that Mutt will dispaly HTML mails for us, and allow us to reply to them properly.
Many more things in mutt can be customized, and if you're using it for any length of time you're definately encouraged to read the mutt manual available on the Mutt homepage.
[ Parent | Reply to this comment ]
/dev/null
Damn, you beat me to it ...
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
W3M is by far the best ncurses-browser.
Try it.
Another thing: why did you not include a tip for opening the HTML-mail in a new tab in Firefox via "firefox -remote"?
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Because I only read email with mutt, that's why!
I've used IMAP, POP3, and various clients over the years, but nothing has the power and customization of Mutt, except possibly emacs..
Steve
-- Steve.org.uk
[ Parent | Reply to this comment ]
text/html; /usr/bin/html2text -nobs %s; copiousoutput; description=HTML Text
-nobs (no backspace) tells it to exclude special characters for bold and similar that are interpreted by less.
(I wonder if this is like slashdot, and posting to an old article is like talking out loud in an empty room.)
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
At least I've seen the comment - as will anybody else that arrives here via google :)
Steve
-- Steve.org.uk
[ Parent | Reply to this comment ]
Thanks, Steve! My ~/.mailcap has been updated.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
I need to create/add it to ~/.mutt/mailcap
Also, I have ~/.mutt/muttrc instead of ~/.muttrc
Using debian 'testing', April 2007.
[ Parent | Reply to this comment ]
alternative_order text/plain
[ Parent | Reply to this comment ]
BTW, do you know how to get links to decode characters properly? I'd like to read html email with mutt encapsulating Chinese characters. Thanks.
[ Parent | Reply to this comment ]