使用 Notmuch 組織你的郵件

使用 Notmuch 組織你的郵件

Notmuch 可以索引、標記和排序電子郵件。在我們的 20 個使用開源提升生產力的系列的第四篇文章中瞭解該如何使用它。-- Kevin Sonney(作者)


去年,我在 19 天裡給你介紹了 19 個新(對你而言)的生產力工具。今年,我換了一種方式:使用你在使用或者還沒使用的工具,構建一個使你可以在新一年更加高效的環境。

用 Notmuch 為你的郵件建立索引

昨天,我談到了如何使用 OfflineIMAP 將我的郵件同步 到本地計算機。今天,我將討論如何在閱讀之前預處理所有郵件。

使用 Notmuch 組織你的郵件

Notmuch


Maildir 可能是最有用的郵件存儲格式之一。有很多工具可以幫助你管理郵件。我經常使用一個名為 Notmuch 的小程序,它能索引、標記和搜索郵件。Notmuch 配合其他幾個程序一起使用可以使處理大量郵件更加容易。

大多數 Linux 發行版都包含 Notmuch,你也可以在 MacOS 上獲得它。Windows 用戶可以通過 Linux 的 Windows 子系統( WSL )訪問它,但可能需要進行一些其他調整。

使用 Notmuch 組織你的郵件

Notmuch's first run


Notmuch 首次運行時,它將詢問你一些問題,並在家目錄中創建 .notmuch-config 文件。接下來,運行 notmuch new 來索引並標記所有郵件。你可以使用 notmuch search tag:new 進行驗證,它會找到所有帶有 new 標籤的消息。這可能會有很多郵件,因為 Notmuch 使用 new 標籤來指示新郵件,因此你需要對其進行清理。

運行 notmuch search tag:unread 來查找未讀消息,這會減少很多郵件。要從你已閱讀的消息中刪除 new 標籤,請運行 notmuch tag -new not tag:unread,它將搜索所有沒有 unread 標籤的消息,並從其中刪除 new 標籤。現在,當你運行 notmuch search tag:new 時,它將僅顯示未讀郵件。

但是,批量標記消息可能更有用,因為在每次運行時手動更新標記可能非常繁瑣。--batch 命令行選項告訴 Notmuch 讀取多行命令並執行它們。還有一個 --input=filename 選項,該選項從文件中讀取命令並應用它們。我有一個名為 tagmail.notmuch 的文件,用於給“新”郵件添加標籤;它看起來像這樣:

<code># Manage sent, spam, and trash folders-unread -new folder:Trash-unread -new folder:Spam-unread -new folder:Sent# Note mail sent specifically to me (excluding bug mail)+to-me to:kevin at sonney.com and tag:new and not tag:to-me# And note all mail sent from me+sent from:kevin at sonney.com and tag:new and not tag:sent# Remove the new tag from messages-new tag:new/<code>

我可以在運行 notmuch new 後運行 notmuch tag --input=tagmail.notmuch 批量處理我的郵件,之後我也可以搜索這些標籤。

Notmuch 還支持 pre-new 和 post-new 鉤子。這些腳本存放在 Maildir/.notmuch/hooks 中,它們定義了在使用 notmuch new 索引新郵件之前(pre-new)和之後(post-new)要做的操作。在昨天的文章中,我談到了使用 OfflineIMAP 同步來自 IMAP 服務器的郵件。從 pre-new 鉤子運行它非常容易:

<code>#!/bin/bash# Remove the new tag from messages that are still tagged as newnotmuch tag -new tag:new# Sync mail messagesofflineimap -a LocalSync -u quiet/<code>

你還可以使用可以操作 Notmuch 數據庫的 Python 應用 afew ,來為你標記郵件列表和垃圾郵件。你可以用類似的方法在 post-new 鉤子中使用 afew:

<code>#!/bin/bash# tag with my custom tagsnotmuch tag --input=~/tagmail.notmuch# Run afew to tag new mailafew -t -n/<code>

我建議你在使用 afew 標記郵件時,不要使用 [ListMailsFilter],因為某些郵件處理程序會在郵件中添加模糊或者徹頭徹尾是垃圾的列表標頭(我說的就是你 Google)。

使用 Notmuch 組織你的郵件

alot email client


此時,任何支持 Notmuch 或 Maildir 的郵件閱讀器都可以讀取我的郵件。有時,我會使用 alot (一個 Notmuch 特定的客戶端)在控制檯中閱讀郵件,但是它不像其他郵件閱讀器那麼美觀。

在接下來的幾天,我將向你展示其他一些郵件客戶端,它們可能會與你在使用的工具集成在一起。同時,請查看可與 Maildir 郵箱一起使用的其他工具。你可能會發現我沒發現的好東西。


via: https://opensource.com/article/20/1/organize-email-notmuch

作者: Kevin Sonney 選題: lujun9972 譯者: geekpi 校對: wxy

本文由 LCTT 原創編譯, Linux中國 榮譽推出


分享到:


相關文章: