[
    {
        "role": "user",
        "content": "I%20love%20neomutt%20but%20so%20many%20emails%20today%20come%20in%20as%20html.%20i%20just%20want%20to%20read%20them%20as%20text.%20my%20pager%20is%20emacs.%20what%20can%20be%20done%3F"
    },
    {
        "role": "assistant",
        "content": "If you're using NeoMutt and want *all emails*\u2014especially HTML ones\u2014to show as plain text (or at least have plain-text be the default), even when you\u2019re paging through them in an environment like Emacs in a terminal, you have several good options. Below are strategies and configuration snippets that will help you achieve that behavior, plus ways to fall back to HTML rendering only when you really need it.\n\n---\n\n## 1. Prefer `text/plain` when available\n\nNeoMutt has a setting called `alternative-order` that sets your preferred order of MIME parts (e.g. `text/plain`, `text/html`, etc.). By putting `text/plain` first, NeoMutt will favor the plain-text version of `multipart/alternative` emails whenever it's present. This means HTML versions will often be ignored unless there\u2019s no other representation. ([neomutt.org](https://neomutt.org/guide/mimesupport?utm_source=openai))\n\nHere\u2019s a typical minimal config line for this:\n\n```\nalternative-order text/plain text/html text/*\n```\n\nThis tells NeoMutt: use `text/plain` if available; if not, use `text/html`; if that fails, try any other `text/*`. If you want, you can exclude HTML entirely from `alternative-order` so NeoMutt never falls back to HTML unless explicitly asked. ([neomutt.org](https://neomutt.org/guide/mimesupport?utm_source=openai))\n\n---\n\n## 2. Use `auto-view` + a mailcap entry for HTML\n\nTo handle HTML parts automatically\u2014i.e. view them through a converter that dumps them to text\u2014you can use `auto-view text/html` in your config and set up a `mailcap` file to describe how to convert HTML to text. E.g., using `lynx -dump` or `w3m -dump` for a clean text dump. ([howtogeek.com](https://www.howtogeek.com/command-line-email-with-mutt/?utm_source=openai))\n\nSample `.neomuttrc` config lines:\n\n```\nauto-view text/html\nalternative-order text/plain text/html\n```\n\nAnd in `~/.mailcap`:\n\n```\ntext/html; w3m -dump -T text/html %s; copiousoutput\n```\n\n(the `copiousoutput` flag tells NeoMutt that this command produces lots of text output that's okay to show in the pager.) ([neomutt.org](https://neomutt.org/guide/mimesupport?utm_source=openai))\n\n---\n\n## 3. Fallback macros / manual \u201cview-as-text\u201d\n\nSometimes you *do* want to inspect the HTML version (embedded links, layout, etc.), but only on demand. You can define Neomutt macros to open a message\u2019s HTML part manually, rather than auto-rendering it. For example:\n\n- Bind a key (like `V`) in the attachment viewer (`v`) to open the HTML part in a real browser.\n- Use pipes (`|`) or mailcap entries with `View-Mailcap` to trigger external commands only when you want to. ([reddit.com](https://www.reddit.com/r/commandline/comments/z7vkwn?utm_source=openai))\n\n---\n\n## 4. Sample complete setup\n\nHere\u2019s a starter setup you can drop into your `~/.neomuttrc` or similar, designed to default to plain-text, convert HTML automatically to text when plain isn\u2019t present, and allow HTML fallback manually:\n\n```text\n# ~/.neomuttrc\n\n# Prefer plain text\nalternative-order text/plain text/html\n\n# auto-view HTML attachments through text dumping\nauto-view text/html\n\n# Optional: suppress showing HTML inline automatically\n# Uncomment following if plain-text is always preferred\n# unauto-view text/html\n\n# Binder: in attachment view, 'V' opens HTML in an external browser\nmacro attach V \"<pipe-entry>lynx %s<enter>\" \"Open HTML part in lynx\"\n\n```\n\nAnd your `~/.mailcap`:\n\n```mailcap\ntext/html; w3m -dump -T text/html %s; copiousoutput; description=HTML-as-text\n```\n\nAdjust `w3m` to `lynx` or whatever text-browser you prefer.\n\n---\n\n## 5. Using Emacs as a pager\n\nSince you said your pager is Emacs (terminal mode), you might integrate with Emacs\u2019s email reading tools (like Gnus, mu4e, or Rmail) and set up their HTML-handling similarly:\n\n- Configure them to strip or ignore HTML and only show text/plain when both are present.\n- Use external tools (or built-in ones) in Emacs to convert HTML to text (e.g. via `shr`, `w3m`, or `html2text`).\n- Ensure that when NeoMutt calls an external viewer (`mailcap` or `auto-view`), it sends output that Emacs can handle cleanly\u2014e.g. via pager buffers. (You may use something like `| html2text`.)\n\n---\n\n## 6. Caveats and gotchas\n\n- **No plain-text part**: Sometimes senders don\u2019t include a `text/plain` version. In those cases, NeoMutt will either show the HTML part (if you allow it in `alternative-order`) or convert the HTML via your `auto-view` setup. You can force it always to fallback to your converter if you don\u2019t trust HTML.  \n- **Images, remote media, tracking pixels**: Viewing HTML (or even just loading links) could pull in tracking content. Sticking with text/plain or text-only renderers avoids that.  \n- **Line wrapping & formatting**: Text dumps are often lossier. Tables, heavy formatting, etc., will look less pretty. But if you mostly want readable text, it works very well.\n\n---\n\nIf you want, I can build you a *complete sample config* (tailored to your OS + Emacs setup) that makes this behavior default and super smooth\u2014would you prefer that?"
    }
]