Re: whitelisting

Subject: Re: whitelisting

Date: Mon, 06 Mar 2017 16:02:50 -0800

To: Jameson Graef Rollins

Cc: notmuch@notmuchmail.org

From: Steven Allen


Jameson,

> 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@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.

- Steven
signature.asc (application/pgp-signature)

Thread: