On Mon, Mar 06 2017, Steven Allen wrote: > Instead of iterating over all messages in spam, why not just iterate > over *new* messages (`tag:new`) in your pre hook? That is (pseudo code): > > for message in `notmuch search tag:new and tag:spam`: > for author in message.headers["From"]: > author = clean(author) # Extract the *actual* email address (name@domain). > # There are probably faster ways to check this... > if `notmuch count tag:sent and to:author` > 0: > notmuch tag -spam -- message > > That should be reasonably fast. Thanks for the suggestion, Steven. Yes, my intention was to restrict over just "new", and yes, it is considerably faster. Thanks for the tip. jamie.