在 mutt 中从外部打开 html 附件

rom*_*ovs 24 lynx mutt browser html

我最近设法设置了我的 mailcap,以便 mutt 可以在消息窗口中显示 HTML 电子邮件:

# ~/.mailcap
text/html; lynx -dump '%s' | more; nametemplate=%s.html; copiousoutput;
Run Code Online (Sandbox Code Playgroud)

这是自动化的:

# ~/.muttrc
auto_view text/html
Run Code Online (Sandbox Code Playgroud)

虽然我认为lynx在将 HTML 转换为文本方面做得不错,但有时这并不能解决问题,我希望能够在我的网络浏览器 ( luakit) 中打开 HTML 附件。

有没有办法透明地做到这一点?对我来说一个好的工作流程如下:

  1. 打开邮件(lynx转换它)
  2. 看到它太复杂了 lynx
  3. 按“v”
  4. 导航到 HTML 附件
  5. 按“输入”打开邮件luakit

jas*_*yan 33

你可以用 mutt's mime support来做到这一点。

此外,您可以在 Autoview 中使用它来表示用于查看附件的两个命令,一个是自动查看的,另一个是从附件菜单中交互查看的。

本质上,您在mailcap文件1 中包含两个选项。

text/html; luakit '%s' &; test=test -n "$DISPLAY"; needsterminal;
text/html; lynx -dump %s; nametemplate=%s.html; copiousoutput;
Run Code Online (Sandbox Code Playgroud)

X正在运行的第一个条目测试,如果是,它将文件交给 luakit。然而,默认值是由copiousoutput标签决定的,所以它会被 lynx 渲染成 mutt。

您将需要这些选项.muttrc

auto_view text/html                                   # view html automatically
alternative_order text/plain text/enriched text/html  # save html for last
Run Code Online (Sandbox Code Playgroud)

如果您想在浏览器中查看它,只需点击v查看附加的 HTML,然后m将其发送到 mailcap。

为方便起见,我绑定Enter到该函数muttrc

bind attach <return>    view-mailcap
Run Code Online (Sandbox Code Playgroud)


1. 请注意,我不使用 lynx 或 luakit,因此这些选项仅供参考。
无耻地转载自这篇博文......