diff options
| author | Hannu Hartikainen <hannu@hrtk.in> | 2021-07-02 12:13:09 +0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-08-29 18:10:08 -0700 |
| commit | 717e3dcdc3e55d72c8e4a1948708c34170dbf926 (patch) | |
| tree | 201a67a609ac6e83ff71206e31f50ada26623824 /lib | |
| parent | 8c0bebedc5edbff5ddc46b66da1177ec18f48c69 (diff) | |
lib: consider all instances of Delivered-To header
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.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/message-file.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/message-file.c b/lib/message-file.c index 647ccf3a..68f646a4 100644 --- a/lib/message-file.c +++ b/lib/message-file.c @@ -291,11 +291,16 @@ _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 (eg. + * primary_email before other_email). */ decoded = _notmuch_message_file_get_combined_header (message, header); } else { |
