Strip HTML in mutt
A quick fix for conveniently reading (and replying to) HTML MIME emails in mutt mail agent.
Here’s the 3-step solution:
- Add the following line to
~/.muttrc
auto_view text/html
- Add another line, to
~/.mailcap
text/html; lynx -dump %s; copiousoutput; nametemplate=%s.html
- (Optional, but Strongly recommended) Add the following line to
~/.bashrc
export TMPDIR=$HOME/tmp
(and do amkdir ~/tmp
of course)
If you don’t do the 3rd step you’re getting yourself under all sorts of risks associated with using common /tmp
directory – that’s what mutt will use by default for all HTML emails you view, The temp files stored in /tmp
will be stored unencrypted, while your HOME
‘s tmp may be protected with the homedir’s ecryptfs.
And while you’re at it you can add more mailcap entries like this:
auto_view text/html text/enriched application/x-gunzip application/postscript image/gif application/x-tar-gz
– with the corresponding lines going to ~/.mailcap
(see Mutt MIME docs for details)
Thank you!
This tutorial is very good!
Regards,
Kees
Thank you. Always looking for ways to make mutt more useful. Preliminary testing is looking great with this configuration.
You can also use
set tmpdir=$HOME/tmp
in your .muttrc instead of defining it in .bashrc
Cool. Didn’t think about putting tmpdir definition into .muttrc and having it in .bashrc was giving me a lot of troubles with new users who didn’t have ~/tmp in their homes.
You might want to also add “lynx -localhost -dump %s”. AFAIR lynx should not do any automatic fetching by default but better safe than sorry.