Install lynx (or links or w3m). Add this to your ~/.muttrc:
auto_view text/html
alternative_order text/plain text/html
Add this to ~/.mailcap:
text/html; lynx -dump -localhost -force_html %s | sed 's/^ *//'; copiousoutput
auto_view text/html
alternative_order text/plain text/html
Add this to ~/.mailcap:
text/html; lynx -dump -localhost -force_html %s | sed 's/^ *//'; copiousoutput
pandoc -f html -t plain
you have to try all three and see what works best. In my experience, pandoc tries to reproduce the page faithfully using ascii art, while lynx output is the easiest to read.If you're going to use w3m, it's wise to wrap it with socksify to prevent email spam from tracking you:
export SOCKS_SERVER="127.0.0.1:1"
exec socksify w3m -dump text/html; unshare -U -n lynx -assume_charset=%{charset} -stdin -dump; copiousoutput;
This creates a new user namespace (-U) and then network namespace (-n), meaning there is no way for the lynx process to communicate with the outside world.(requires unprivileged userns, which is default enabled on recent distros. "sysctl -w kernel.unprivileged_userns_clone=1" if not.)