Render HTML Email with Mailcap#
Prerequisites#
Install a text-mode browser such as
w3m,lynx, orelinks.Locate your mailcap file (
$mailcap_path) or decide where to create one.
Add a Mailcap Entry for HTML#
Add a
text/htmlentry to your mailcap file:
text/html; lynx -dump %s; copiousoutput
Save the mailcap file.
Expected result: NeoMutt can render HTML messages as text using lynx.
Choose a Different Renderer#
Replace the command with your preferred tool:
text/html; w3m -dump -T text/html %s; copiousoutput
or
text/html; elinks -dump %s; copiousoutput
Expected result: HTML rendering uses your preferred program.
Auto-View HTML Parts#
Enable autoview for HTML:
auto-view text/html
Open a message with HTML content.
Expected result: NeoMutt renders HTML parts automatically.
Verify Mailcap Search Order#
Check where NeoMutt looks for mailcap files:
neomutt -nF /dev/null -Q mailcap_path
Expected result: you see the search path NeoMutt will use for mailcap.
Keep Mailcap Secure#
Avoid backticks and untrusted shell expansions inside mailcap entries.
Use
mailcap_sanitizeif you need stricter controls on mailcap expansion.
Expected result: HTML rendering works without introducing unsafe command execution.
See also MIME Types and MIME.