afewmail / afew

an initial tagging script for notmuch mail
ISC License
325 stars 98 forks source link

SentMailsFilter not working #239

Closed yiufung closed 5 years ago

yiufung commented 5 years ago

I have tried both [ArchiveSentMailsFilter] and [SentMailsFilter], but no mails I sent is tagged as sent. Debugging with afew --tag --all -vv > filter.log 2>&1, I saw that the filter is run, but no matches are found so it moves to next filter directly:

INFO:afew.filters.SentMailsFilter.SentMailsFilter:Tagging all mails sent by myself to others
DEBUG:root:Executing query '(from:"myaddr@gmail.com" OR from:"mail@myaddr.net") AND NOT (to:"myaddr@gmail.com" OR to:"mail@myaddr.net")'
INFO:afew.filters.InboxFilter.InboxFilter:Retags all messages not tagged as junk or killed as inbox

However, the query give me results if I search it using notmuch search or in notmuch-emacs.

So I tried to put it separately under [InboxFilter]

[Filter.1]
query = '(from:"myaddr@gmail.com" OR from:"mail@myaddr.net") AND NOT (to:"myaddr@gmail.com" OR to:"mail@myaddr.net")'
tags = +sent
message = Mail I sent

Debug info becomes (note the extra '\ around the query):

DEBUG:root:Executing query '\'(from:"myaddr@gmail.com" OR from:"mail@myaddr.net") AND NOT (to:"myaddr@gmail.com" OR to:"mail@myaddr.net")\''

Still no messages are tagged in this setting.

Any hints?


afew config:

[SpamFilter]
[KillThreadsFilter]
[ListMailsFilter]
[SentMailsFilter]
[InboxFilter]
[Filter.1]
query = '(from:"myaddr@gmail.com" OR from:"mail@myaddr.net") AND NOT (to:"myaddr@gmail.com" OR to:"mail@myaddr.net")'
tags = +sent
message = Mail I sent

notmuch config:

[database]
path=/home/yiufung/Maildir

[user]
name=My Name
primary_email=myaddr@gmail.com
other_email=mail@myaddr.net;

[new]
tags=new
ignore=.mbsyncstate;.isyncuidmap.db;.uidvalidity

[search]
exclude_tags=deleted;spam;

[maildir]
synchronize_flags=true

mbsync 1.3.0, notmuch 0.28.3, afew 1.3.0, Emacs 26.2

yiufung commented 5 years ago

Ah, so I actually need to put sent_tag = sent under [SentMailFilter] as mentioned in SentMailsFilter.

[SentMailsFilter]
sent_tag = sent

The default behavior of not adding a sent tag while [ArchiveSentMailsFilter] exists in default Configuration is quite surprising. Should we change it? Or state it more clearly in Configuration page instead of in docs of its parent class?

yiufung commented 5 years ago

Docs updated, issue closed.