From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id oNqBEqyj7maIgwAAqHPOHw:P1 (envelope-from ) for ; Sat, 21 Sep 2024 10:45:00 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id oNqBEqyj7maIgwAAqHPOHw (envelope-from ) for ; Sat, 21 Sep 2024 12:45:00 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmx.net header.s=s31663417 header.b=W0TzTJn4; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.net (policy=quarantine) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1726915499; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=OtpwCRCzRunmrk8JPmb7PshNLE+NcXoN3+oBoeUyzFE=; b=nwSMB9baBmHfD8BXr9fn0iO2ml1+VyA+yGR44Jt+zYxYaMJN+KaSBlOBcLRM6KXl3EZASi /J4oLxscU+Hub5WuCyqBBWeb6/sqRJbwzVdoIIzTja3DxF1VFR/jiJlEPIytFLeXCPMnrU 0yBSSzAFc9z4eBrRDu0Feqw3QEyFxIStfpj8JJQ+CO4OfC3QEcNK4FwGMIL0JSoSAS25go ygSgFoMvgIegLtfNr4AcDJbCXUUph/S8dlKm/N+p3TmcbDvq+chpTZksgvAc0xvWhLzrRy +o+0qQn8sAJnNcP0I84A7JVq6g2amrKZGLCAtzrVb9DppqLeDP4iEFRZFWruaw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmx.net header.s=s31663417 header.b=W0TzTJn4; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.net (policy=quarantine) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1726915499; a=rsa-sha256; cv=none; b=j4i7VvqMtdf0hc3anYJ409yp+LGso6k/U5QOy1/WkWwyTkjcZBLnXEae4Lu7irHadHbsWb rgEPyG6kmboD9gA8ruit4e7TzwU5eLTQTLlTO/FEYgxHSTSCK6I7Mkhk+u3siVzByEL6xY 8uC/Mgk1+TLyv0JKdiFWGUMcFcHcodBRontlv2P5mmRGD+xBVv1Jc+0HHE3oIO4hBgCi6M pwHpP9nrpgP44nDcpJS+Aa/xV/ekBtiqBv7JGgKEodSkcxaOkQbg3x+BpMrbCi5Uk3s8aL i1gG7/iBBHwj2z4v9DPr9g2wDKqRbRfxQVOy2D6py12sGF/8x9UPhBNARb5iAw== Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CF02A69281 for ; Sat, 21 Sep 2024 12:44:59 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 0E28E5F81C; Sat, 21 Sep 2024 10:44:57 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by mail.notmuchmail.org (Postfix) with ESMTPS id 209EB5E527 for ; Sat, 21 Sep 2024 10:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1726915488; x=1727520288; i=telegraph@gmx.net; bh=7HbETgk4STIybrNWMRtu1gnEMRhC5IgFBBp3lrod64E=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=W0TzTJn4aPJOVwjcgSPTsuuaj4KOlfKJJ3QW+/HAi6jXAQ/a3y+zt3jai5o46EHF 0etREOHX5kCJC4oe1ZlLnu/DPrYaeT6NlwNIeuB41DNDCs+/BUG+glMFHxPV8QYkK bSKPjrQ/4kNF2jvJr8cRCKJpV5rk1Nd4IYpzXc6KcqLL6Jnft6PbpbK0uUqLFrGld wwvzgdn4xwCiGuYguS0FQtULvA0Wnz1ZgNwZEYYfGGhw8M9epfdp1U9bsN45Ksg9E jvlWKH6C1XCnQBze1BPWmXZmKuuphlR91yLHGcWMziuzXt6A7m1GGcCaOmagvMkWY bTDFSTpZVJQhuGgsbA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost ([95.90.234.156]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N49lJ-1rsXDN2PhZ-0103Hz; Sat, 21 Sep 2024 12:44:48 +0200 From: Gregor Zattler To: frederik@ofb.net, Pengji Zhang Subject: Re: searching for a message by path In-Reply-To: <20240921032340.opozeclfbyqzw2yt@localhost> References: <20240920175232.zryeqyl76nbydiab@localhost> <87zfo1dfa1.fsf@pengjiz.com> <20240921032340.opozeclfbyqzw2yt@localhost> Mail-Followup-To: frederik@ofb.net, Pengji Zhang , notmuch@notmuchmail.org Date: Sat, 21 Sep 2024 12:44:13 +0200 Message-ID: <87ed5djngi.fsf@no.lan> MIME-Version: 1.0 X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iIIORn4dbHliqR9qrNfP+ggo9H3AR0Zi73CEy1HsY/CC1PAeSud9nTbIiK c+KEb5a6tZholJ3DVpBMj/Hg== Message-ID-Hash: TT5S72KIXXK4OM6HCFXVXUMDD4XESVIE X-Message-ID-Hash: TT5S72KIXXK4OM6HCFXVXUMDD4XESVIE X-MailFrom: telegraph@gmx.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: notmuch@notmuchmail.org X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE X-Migadu-Queue-Id: CF02A69281 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -1.21 X-Migadu-Spam-Score: -1.21 X-TUID: hwoO85Q9aYTh Hi Frederick, * Frederick Eaton [2024-09-20; 20:23 -07]: > On Sat, Sep 21, 2024 at 08:25:10AM +0800, Pengji Zhang wrote: >>Frederick Eaton writes: >>>I am trying to figure out how to adapt a script I wrote for >>>filtering messages, to apply notmuch tags to each message. A >>>difficulty is that the messages are already in the Notmuch database, >>>because another tool has delivered them to a maildir and run >>>"notmuch new". >>> >>>Now, Notmuch can provide me with the paths of all the new >>>(unfiltered) messages, which I can give to my script. The question I >>>have is, once the filter is done, how can the script tell Notmuch >>>which message to apply the tags to? [...] > Suppose the filter script reads a message from a particular file and decides that it is spam. How does the filter tell Notmuch that the message corresponding to that file is spam? You seem to be saying below that the filter script should extract the Message-ID and use it to identify the message to Notmuch, since file paths of the messages are not indexed. Probably what my script should be doing for each message is appending a line to a batch file like this: > > +spam -new -- id:some_message_id@foo > +inbox -new -- id:some_other@baz > > and then passing the batch file to "notmuch tag"? Yes. I assume your script somehow loops over directories and picks up one file at a time investigating it and then decides if it is spam. Then what you wrote above is the way to go. The possibility that the Message-ID of two different emails might be identical, is real, but that's luckily mostly the case for spam messages in my experience. But there is a safety hatch: While notmuch cannot search by file names, it is able to output file names, like so: notmuch search --output=files -- id:"100822114556.GC10314@example.com/" If you want to be extra cautious you could start with a file, get the Message-ID from it, decide upon the email in the file, then search for file names which notmuch associates to the Message-ID and in case of several file names, check them in turn... In case of the spam/ham decision, you then would have to decide what to do, if some files containing emails with the same Message-ID are spam and others are ham, since these are usually considered to be mutually exclusive. But I would be astonished if you would find such a case in a real file corpus of emails. HTH, Gregor