steven at stebalien.com
Mon Mar 6 16:02:50 PST 2017
> This works ok, but takes more than 20s to execute, which will slow down
> my inbox processing quite a bit. I could try to write a python script
> to iterate over all tag:spam, extract addresses from those messages, and
> match against the whitelist, but I doubt that will be any faster.
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 at 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.
Note: you probably will have to do this in python because extracting the
from addresses otherwise is a bit of a pain.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 832 bytes
Desc: not available
More information about the notmuch