Re: tell me how to do this right (mail sent to lists)

Subject: Re: tell me how to do this right (mail sent to lists)

Date: Thu, 11 Oct 2018 11:22:28 +0200

To: Jeff Templon, David Bremner, Carl Worth, Daniel Kahn Gillmor

Cc: ,

From: Martin Jambor


I am a notmuch newbie and do not use afew (but have my own post-new hook
script), but...

On Wed, Oct 10 2018, Jeff Templon wrote:
> Hi David, all:
> David Bremner <> writes:
>> The tag is not associated with the file in Sent, it is associated
>> with the message-id.
> I guess I didn't make myself clear enough, again.  I didn't mean that
> the tag is associated with the file.  What I am guessing is something
> like this:
> for message in new_messages:
>    if not in database:
>       process message and determine list of tags
>       appy those tags to the messageID
> new_messages is the list of files that notmuch had not yet seen.

...I don't think the above is entirely accurate.  IIUC, what happens is
that when notmuch sees a message for the first time during "notmuch
new", it simply and only applies the tags specified in the tags entry of
[new] section in .notmuch-config file to them - the default I believe is

Then the post-hook is executed, which in your case I presume runs afew
somehow, and typically that hook goes over all messages with the tag
new, process them in an arbitrary way, sometimes adding further tags
according to the contents, and eventually drops the new tag.

I guess a potential problem is that notmuch sees the message the first
time when you send it and it adds the new tag and post-hook processes
the outgoing version.  When it arrives back, I believe notmuch does not
apply the new tag to it anymore.  This means that post-hook does not get
to process the incoming version, which might be a problem if you want to
see stuff added by a remote party, for example when you want to grep the
file and look for Sender header in order to mark it as coming from a
particular mailing list.

That is the reason I do not attempt this in my post-hook and rely on
notmuch "tag:new AND to:mailinglist@address" search which is not really
precise but at least it should be probably faster.

Perhaps it would be a good idea to split the tags entry in [new] section
into two, one for tags added to each previously unknown message-id
(default would be unread and inbox) and a new one for each new file
(default new)?

Let me stress again that I am a newbie and can be completely wrong about
anything above, so take it with a grain of salt.



notmuch mailing list