很少搜索自定义标头值

Max*_*nni 5 email search-engine

是否可以使用notmuch搜索包含特定自定义标头值的电子邮件

我知道可以搜索标准标题,例如

notmuch search from:alice subject:hello to:bob@example.com
Run Code Online (Sandbox Code Playgroud)

但是有没有办法搜索这样的东西?

notmuch search Accept-Language:en-US X-Spam-Flag:NO
Run Code Online (Sandbox Code Playgroud)

Jak*_*dra 5

0.29开始就有可能- 请参阅notmuch-config(1) 的手册页

   index.header.<prefix> [STORED IN DATABASE]
          Define  the  query  prefix <prefix>, based on a mail header. For
          example index.header.List=List-Id will add a probabilistic  pre?
          fix  List:  that  searches the List-Id field.  User defined pre?
          fixes must not start with 'a'...'z'; in particular adding a pre?
          fix  with same name as a predefined prefix is not supported. See
          notmuch-search-terms(7) for a list of existing prefixes, and  an
          explanation of probabilistic prefixes.
Run Code Online (Sandbox Code Playgroud)

如手册中所述,它存储在数据库中 - 类似于自定义查询。您必须为要搜索的每个标题设置它。

所以在你的问题中提到的情况下:

notmuch config set index.header.AcceptLanguage Accept-Language
notmuch config set index.header.XSpamFlag X-Spam-Flag
Run Code Online (Sandbox Code Playgroud)

您可能需要重新索引数据库 notmuch reindex '*'

最后运行搜索

notmuch search AcceptLanguage:en-US AND XSpamFlag:NO