Under Development
stars

Combine Multiple Query Conditions#

Prerequisites#

  1. Notmuch integration working in NeoMutt (see Setting Up Notmuch).

AND β€” Match All Conditions#

  1. Use and to require multiple criteria:

virtual-mailboxes "Work Unread" "notmuch://?query=tag:work and tag:unread"

Expected result: only messages that are both tagged work and tagged unread are shown.

OR β€” Match Any Condition#

  1. Use or to accept either criterion:

virtual-mailboxes "Team" "notmuch://?query=from:alice@example.com or from:bob@example.com"

Expected result: messages from Alice or Bob are shown.

NOT β€” Exclude Messages#

  1. Use not to remove unwanted messages:

virtual-mailboxes "Inbox Clean" "notmuch://?query=tag:inbox and not tag:spam"

Expected result: inbox messages appear, but spam-tagged messages are excluded.

Parentheses β€” Group Conditions#

  1. Use parentheses to control evaluation order:

virtual-mailboxes "Priority" \
  "notmuch://?query=tag:inbox and (tag:flagged or tag:unread)"

Expected result: inbox messages that are either flagged or unread are shown.

Test Queries on the Command Line#

Before adding a query to your config, test it with notmuch search:

notmuch search 'tag:inbox and (tag:flagged or tag:unread)'

Expected result: you see the matching messages, confirming the query is correct before using it in NeoMutt.

See Notmuch for the full URL syntax and Notmuch Advanced Queries for windowed queries.