Sample Header Ad - 728x90

How to get the notmuch message-id and thread-id from a maildir message filename already in the notmuch db?

2 votes
2 answers
916 views
Let's assume that I make a notmuch query that returns files: $ notmuch search --output=files tag:inbox from:love This returns a list of files, pointing to Maildir messages. Now I pick one of these files (already in the notmuch database), for instance with FILENAME=$(notmuch search --output=files tag:inbox from:love | fzf) and I would like to get its message-id and thread-id in the notmuch database. __From the variable $FILENAME, I would like to find the message-id in notmuch.__ A very sloppy way to do this is to parse the file, read the headers from/subject/date and make a notmuch query `notmuch search from:{...} subject:{...} date:{..}`. But since the filenames are already stored in the database, I guess there should be a canonical and robust way to obtain the mesage-id from the filename. Thanks!
Asked by jlewk (131 rep)
Aug 23, 2020, 08:38 PM
Last activity: Aug 26, 2020, 10:39 AM