Re: searching for a message by path

Subject: Re: searching for a message by path

Date: Sat, 21 Sep 2024 20:30:12 +0300

To: Panayotis Manganaris, frederik@ofb.net

Cc: notmuch@notmuchmail.org

From: Teemu Likonen


* 2024-09-21 12:24:14-0400, Panayotis Manganaris wrote:

> Like you, I have notmuch configured to assign newly fetched mail with
> tag "new"
>
> notmuch search --output=messages 'tag:new' > /tmp/msgs
> notmuch search --output=files 'tag:new' |\
>     bogofilter -o0.7,0.7 -bt |\
>     paste - /tmp/msgs |\
>     awk '$1 ~ /S/ { print "-new +spam", "-", $3 }' |\
>     notmuch tag --batch

I think that is unnecessarily complex. How about simply using
Bogofilter's output value:


    for msgid in $(notmuch search --output=messages tag:new); do
            notmuch show --exclude=false --format=raw "$msgid" | bogofilter
            case $? in
            0) # Spam
                    notmuch tag +spam "$msgid"
                    # Add some logic and conditionally run:
                    #notmuch tag +learn-spam "$msgid"
                    ;;

            1) # Ham
                    # Add some logic and conditionally run:
                    #notmuch tag +learn-ham "$msgid"
                    ;;

            2) notmuch tag +unsure "$msgid" ;;
            *) exit $? ;;
            esac
    done


Then later process tags "learn-spam" and "learn-ham" by piping such
messages to "bogofilter -s" or "-n".

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462
signature.asc (application/pgp-signature)
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: