在 Mutt 中從外部開啟 HTML 附件

在 Mutt 中從外部開啟 HTML 附件

我最近設法設定了我的 mailcap,以便穆特可以在訊息視窗中顯示 HTML 電子郵件:

# ~/.mailcap
text/html; lynx -dump '%s' | more; nametemplate=%s.html; copiousoutput;

這是透過以下方式實現自動化的:

# ~/.muttrc
auto_view text/html

雖然我認為山貓在將 HTML 轉換為文字方面做得不錯,有時這並不能解決問題,我希望能夠在我的網頁瀏覽器中開啟 HTML 附件盧吉特

有沒有辦法透明地做到這一點?對我來說一個好的工作流程應該是這樣的:

  1. 開啟郵件(Lynx 對其進行轉換)
  2. 發現這對 Lynx 來說太複雜了
  3. v
  4. 導覽至 HTML 附件
  5. Enter以在 Luakit 中開啟郵件。

答案1

你可以用 mutt 來做到這一點默劇支持

此外,您可以將其與「自動查看」一起使用來表示用於查看附件的兩個命令,一個是自動查看,另一個是從附件選單互動查看。

mailcap本質上,您在文件1中包含兩個選項。

text/html; luakit '%s' &; test=test -n "$DISPLAY"; needsterminal;
text/html; lynx -dump %s; nametemplate=%s.html; copiousoutput;

第一個條目測試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

如果您想在瀏覽器中查看它,只需點擊v查看附加的 HTML,然後m將其發送到 mailcap 即可。

為了方便起見,我Enter在以下位置綁定到該函數muttrc

bind attach <return>    view-mailcap

1. 請注意,我不會使用 lynx 或 luakit,因此這些選項僅供參考。
無恥地轉載自這篇文章:https://jasonwryan.com/blog/2012/05/12/mutt/

答案2

借自建築維基百科V,我在 muttrc 中有這個,可以在按下附件視圖時在我的 $BROWSER (Firefox,實際上)中打開 HTML :

# pipe-entry pipes the current entry to iconv. iconv converts text from one character encoding to another
# See this for a description of Mutt functions: https://muttmua.gitlab.io/mutt/manual-dev.html#functions
set my_mail=/tmp/mutt/mail.html
macro attach V "<shell-escape>mkdir -p $(dirname $my_mail)<enter><pipe-entry>iconv -c --to-code=UTF8 > $my_mail<enter><shell-escape>$BROWSER $my_mail<enter>" "Open attachment with $BROWSER"

相關內容