Combine Multiple Query Conditions#
Prerequisites#
Notmuch integration working in NeoMutt (see Setting Up Notmuch).
AND β Match All Conditions#
Use
andto 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#
Use
orto 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#
Use
notto 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#
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.