[PATCH 1/2] cli: also use Delivered-To header to figure out the reply from address

Jani Nikula jani at nikula.org
Fri May 11 07:32:22 PDT 2012


Add another fallback header Delivered-To for guessing the user's from
address for notmuch reply before using the Received
headers. Apparently some MTAs use Delivered-To instead of
X-Original-To (which already exists as a fallback).

Reported-by: Michael Hudson-Doyle <michael.hudson at canonical.com>
Signed-off-by: Jani Nikula <jani at nikula.org>
---
 notmuch-reply.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index 7184a5d..7efd5cd 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -334,7 +334,11 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
     const char *delim=". \t";
     size_t i,j,other_len;
 
-    const char *to_headers[] = {"Envelope-to", "X-Original-To"};
+    const char *to_headers[] = {
+	"Envelope-to",
+	"X-Original-To",
+	"Delivered-To",
+    };
 
     primary = notmuch_config_get_user_primary_email (config);
     other = notmuch_config_get_user_other_email (config, &other_len);
@@ -348,8 +352,9 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
      * the To: or Cc: header. From here we try the following in order:
      * 1) check for an Envelope-to: header
      * 2) check for an X-Original-To: header
-     * 3) check for a (for <email at add.res>) clause in Received: headers
-     * 4) check for the domain part of known email addresses in the
+     * 3) check for a Delivered-To: header
+     * 4) check for a (for <email at add.res>) clause in Received: headers
+     * 5) check for the domain part of known email addresses in the
      *    'by' part of Received headers
      * If none of these work, we give up and return NULL
      */
-- 
1.7.9.5



More information about the notmuch mailing list