From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id j6uLDugT02ATYwEAgWs5BA (envelope-from ) for ; Wed, 23 Jun 2021 12:58:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 4FmoCegT02ASBAAAB5/wlQ (envelope-from ) for ; Wed, 23 Jun 2021 10:58:48 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (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 52B961238B for ; Wed, 23 Jun 2021 12:58:47 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 4FA7D290A3; Wed, 23 Jun 2021 06:58:40 -0400 (EDT) Received: from mailproxy01.manitu.net (mailproxy01.manitu.net [217.11.48.65]) by mail.notmuchmail.org (Postfix) with ESMTPS id D090F290A0 for ; Wed, 23 Jun 2021 06:58:36 -0400 (EDT) Received: from localhost (200116b86049420040fadb412cd98192.dip.versatel-1u1.de [IPv6:2001:16b8:6049:4200:40fa:db41:2cd9:8192]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: michael@grubix.eu) by mailproxy01.manitu.net (Postfix) with ESMTPSA id 082671260028; Wed, 23 Jun 2021 12:58:34 +0200 (CEST) MIME-Version: 1.0 In-Reply-To: <20210623102906.20602-1-hannu@hrtk.in> References: <20210623102906.20602-1-hannu@hrtk.in> Subject: Re: [PATCH] lib: consider all instances of Delivered-To header To: Hannu Hartikainen , notmuch@notmuchmail.org From: Michael J Gruber Message-ID: <162444591341.4884.15473775974370085837.git@grubix.eu> Date: Wed, 23 Jun 2021 12:58:33 +0200 User-Agent: alot/0.9.1 Message-ID-Hash: VFJSYG6B5OJZ7TCTFMSQMY6XLXM5F7EB X-Message-ID-Hash: VFJSYG6B5OJZ7TCTFMSQMY6XLXM5F7EB X-MailFrom: michael@grubix.eu 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624445927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to: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-unsubscribe:list-subscribe:list-post; bh=qdH7SkB9QNSdM7zOjvfNF8zww58SNIYmKE73Vdhkurs=; b=pCwE1l4sFbtK6HgNGb+7BTMaLsSyaVWQbObtGDplSgz56D4BXBcHS8MbxiCpn9bAzPpnD4 JmH2JY6iVd/RLahRP3nbf8RTiXOMsF3NgvIUqyeqtbq0XhNkf2VkjUh3WKmtC43OhzhyD8 V/fk2D005AtQLgH6Rjzof9q4YIEtLfMUuKX5nIhVE9ESjxBZIAzC4WKmXZdhGxxvIkOtWP z975zBv4NQG8QocE4irEOfRaQRWZThiMrE+NkBDKfp9EYvj8rFHzVm4dPkTGevlpV1Qs/B oGGp6y+pewfj2myz/r2YEUhz4zjb83sX0e29sA0Cit9f6llVdijNAO+mwT6vCQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624445927; a=rsa-sha256; cv=none; b=uGJRANfE86ziz33jj0h98OzBnfcf/Z4K5Uxh0LXZxKbY9IPjst8f0Aed07fAa6MCDXNq/S Xj2fL0k2J8GA7XAlLGgkYhP0CNFIZ2ud5ftNkudCNCIkOcfLDIJ64JItrwOFFHCuhxm3xL 61kIOc3kNEB1637dKKF/uhuOzoRkFwpCc4gOQPf0FGgcCQLN52N+KF6KoswXYEMPqH/PQo lKjirAlG7hgaaBm7dIGCxHVtNNpSB0REM3qi4wQgYfX/r6G0TnLonyCsRV1wFYJhDzMexM CqQbZy6abM6E6u4RnWmBv0ty+wxOanrSGysO/T1M1Vo6p7JbsGJZhbNxlzwPbw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.99 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 52B961238B X-Spam-Score: -0.99 X-Migadu-Scanner: scn0.migadu.com X-TUID: 5hu+x2sHveys Hannu Hartikainen venit, vidit, dixit 2021-06-23 12:29:06: > When using notmuch-reply and guessing the From: address from > Delivered-To headers, I had the wrong address chosen today. This was > because the messages from the notmuch list contain these headers in this > order: > > Delivered-To: hannu.hartikainen@gmail.com > ... > Delivered-To: hannu@hrtk.in > > In my .notmuch-config I have the following configuration: > > primary_email=hannu@hrtk.in > other_email=hannu.hartikainen@gmail.com;... > > Before this change, notmuch-reply would guess From: @gmail.com because > that is the first Delivered-To header present. After the change, the > primary address is chosen as I would expect. > --- > lib/message-file.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/lib/message-file.c b/lib/message-file.c > index 647ccf3a..7e8ea09c 100644 > --- a/lib/message-file.c > +++ b/lib/message-file.c > @@ -291,11 +291,15 @@ _notmuch_message_file_get_header (notmuch_message_file_t *message, > if (value) > return value; > > - if (strcasecmp (header, "received") == 0) { > + if (strcasecmp (header, "received") == 0 || > + strcasecmp (header, "delivered-to") == 0) { > /* > - * The Received: header is special. We concatenate all > - * instances of the header as we use this when analyzing the > - * path the mail has taken from sender to recipient. > + * The Received: header is special. We concatenate all instances of the > + * header as we use this when analyzing the path the mail has taken > + * from sender to recipient. > + * > + * Similarly, multiple instances of Delivered-To may be present. We > + * concatenate them so the one with highest priority may be picked. > */ > decoded = _notmuch_message_file_get_combined_header (message, header); > } else { > -- > 2.32.0 Without looking at the surrounding code I'm wondering: Is an address from a received header (still) preferred over one from a delivered-to, or does the order of headers in the mail envelope play a role? Michael