unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* notmuch-reply doesn't use Reply-To
@ 2015-12-03 16:28 Damien Cassou
  2015-12-04 12:07 ` David Bremner
  2015-12-04 12:14 ` David Bremner
  0 siblings, 2 replies; 11+ messages in thread
From: Damien Cassou @ 2015-12-03 16:28 UTC (permalink / raw)
  To: notmuch

Hi,

I've the impression that notmuch-reply doesn't respect the Reply-To
field: I've an email with a Reply-To field. But when I execute "notmuch
reply id:<msg-id>", the To: field is set to the From: field of the
original email and not to the Reply-To: field.

Here is the original email I want to reply to:

    $ notmuch show --format=json --entire-thread=false --body=false "id:565be5e1.X5p1I6XirRudvMa6%seaside@rmod.inria.fr" | json_pp
    [
       [
          [
             {
               [...]
                "headers" : {
                   "To" : "rmod@inria.fr",
                   "Reply-To" : "rmod@inria.fr",
                   "From" : "seaside@rmod.inria.fr",
                   "Subject" : "[rmod] [Mm10s] 2015-11-30",
                   "Date" : "Mon, 30 Nov 2015 07:00:01 +0100"
                },
    [...]


Here is the result of notmuch-reply:

    $ notmuch reply --reply-to=sender --format=json "id:565be5e1.X5p1I6XirRudvMa6%seaside@rmod.inria.fr" | json_pp
    {
       "reply-headers" : {
          "References" : "<565be5e1.X5p1I6XirRudvMa6%seaside@rmod.inria.fr>",
          "Subject" : "Re: [rmod] [Mm10s] 2015-11-30",
          "To" : "seaside@rmod.inria.fr",
          "From" : "Damien Cassou <damien.cassou@inria.fr>",
          "In-reply-to" : "<565be5e1.X5p1I6XirRudvMa6%seaside@rmod.inria.fr>"
       },
       "original" : {
          "tags" : [
    [...]


As you can see, the "To" field of the reply is not set from the original
Reply-To: field, but from the original From: field.

Can anyone help me please?

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: notmuch-reply doesn't use Reply-To
  2015-12-03 16:28 notmuch-reply doesn't use Reply-To Damien Cassou
@ 2015-12-04 12:07 ` David Bremner
  2015-12-04 12:14 ` David Bremner
  1 sibling, 0 replies; 11+ messages in thread
From: David Bremner @ 2015-12-04 12:07 UTC (permalink / raw)
  To: Damien Cassou, notmuch

Damien Cassou <damien@cassou.me> writes:

> Hi,
>
> I've the impression that notmuch-reply doesn't respect the Reply-To
> field: I've an email with a Reply-To field. But when I execute "notmuch
> reply id:<msg-id>", the To: field is set to the From: field of the
> original email and not to the Reply-To: field.
>

Hmm. The following test suggests it doesn't ignore reply-to completely.
Maybe there is some side-effect from --reply-to=sender. What if you try
omitting that?

test_begin_subtest "Support for Reply-To"
add_message '[from]="Sender <sender@example.com>"' \
	     [to]=test_suite@notmuchmail.org \
	     [subject]=notmuch-reply-test \
	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
	    '[body]="support for reply-to"' \
	    '[reply-to]="Sender <elsewhere@example.com>"'

output=$(notmuch reply id:${gen_msg_id})
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
Subject: Re: notmuch-reply-test
To: Sender <elsewhere@example.com>
In-Reply-To: <${gen_msg_id}>
References: <${gen_msg_id}>

On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
> support for reply-to"

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: notmuch-reply doesn't use Reply-To
  2015-12-03 16:28 notmuch-reply doesn't use Reply-To Damien Cassou
  2015-12-04 12:07 ` David Bremner
@ 2015-12-04 12:14 ` David Bremner
  2015-12-04 15:06   ` Tomi Ollila
  2015-12-04 16:40   ` Damien Cassou
  1 sibling, 2 replies; 11+ messages in thread
From: David Bremner @ 2015-12-04 12:14 UTC (permalink / raw)
  To: Damien Cassou, notmuch

Damien Cassou <damien@cassou.me> writes:

>                    "To" : "rmod@inria.fr",
>                    "Reply-To" : "rmod@inria.fr",
>                    "From" : "seaside@rmod.inria.fr",
>                    "Subject" : "[rmod] [Mm10s] 2015-11-30",
>                    "Date" : "Mon, 30 Nov 2015 07:00:01 +0100"

A quick look at the code suggests this is falling victim to the
"reply-to munging" detection code, which considers a reply-to field
redudant if it duplicates one of the other fields. From the source

    /* Some mailing lists munge the Reply-To header despite it being A Bad
     * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
     *
     * The munging is easy to detect, because it results in a
     * redundant reply-to header, (with an address that already exists
     * in either To or Cc). So in this case, we ignore the Reply-To
     * field and use the From header. This ensures the original sender
     * will get the reply even if not subscribed to the list. Note
     * that the address in the Reply-To header will always appear in
     * the reply.
     */

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: notmuch-reply doesn't use Reply-To
  2015-12-04 12:14 ` David Bremner
@ 2015-12-04 15:06   ` Tomi Ollila
  2015-12-04 16:40   ` Damien Cassou
  1 sibling, 0 replies; 11+ messages in thread
From: Tomi Ollila @ 2015-12-04 15:06 UTC (permalink / raw)
  To: notmuch

On Fri, Dec 04 2015, David Bremner <david@tethera.net> wrote:

> Damien Cassou <damien@cassou.me> writes:
>
>>                    "To" : "rmod@inria.fr",
>>                    "Reply-To" : "rmod@inria.fr",
>>                    "From" : "seaside@rmod.inria.fr",
>>                    "Subject" : "[rmod] [Mm10s] 2015-11-30",
>>                    "Date" : "Mon, 30 Nov 2015 07:00:01 +0100"
>
> A quick look at the code suggests this is falling victim to the
> "reply-to munging" detection code, which considers a reply-to field
> redudant if it duplicates one of the other fields. From the source
>
>     /* Some mailing lists munge the Reply-To header despite it being A Bad
>      * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
>      *
>      * The munging is easy to detect, because it results in a
>      * redundant reply-to header, (with an address that already exists
>      * in either To or Cc). So in this case, we ignore the Reply-To
>      * field and use the From header. This ensures the original sender
>      * will get the reply even if not subscribed to the list. Note
>      * that the address in the Reply-To header will always appear in
>      * the reply.
>      */

For anyone who did that feature, Thank You ! :D

Tomi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: notmuch-reply doesn't use Reply-To
  2015-12-04 12:14 ` David Bremner
  2015-12-04 15:06   ` Tomi Ollila
@ 2015-12-04 16:40   ` Damien Cassou
  2015-12-04 17:14     ` David Bremner
  2015-12-04 17:14     ` Jani Nikula
  1 sibling, 2 replies; 11+ messages in thread
From: Damien Cassou @ 2015-12-04 16:40 UTC (permalink / raw)
  To: David Bremner, notmuch

David Bremner <david@tethera.net> writes:

> Damien Cassou <damien@cassou.me> writes:
>
>>                    "To" : "rmod@inria.fr",
>>                    "Reply-To" : "rmod@inria.fr",
>>                    "From" : "seaside@rmod.inria.fr",
>>                    "Subject" : "[rmod] [Mm10s] 2015-11-30",
>>                    "Date" : "Mon, 30 Nov 2015 07:00:01 +0100"
>
> A quick look at the code suggests this is falling victim to the
> "reply-to munging" detection code, which considers a reply-to field
> redudant if it duplicates one of the other fields. From the source
>
>     /* Some mailing lists munge the Reply-To header despite it being A Bad
>      * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
>      *
>      * The munging is easy to detect, because it results in a
>      * redundant reply-to header, (with an address that already exists
>      * in either To or Cc). So in this case, we ignore the Reply-To
>      * field and use the From header. This ensures the original sender
>      * will get the reply even if not subscribed to the list. Note
>      * that the address in the Reply-To header will always appear in
>      * the reply.
>      */


The last sentence seems to contradict my example:

    Note that the address in the Reply-To header will always appear in
    the reply.

Here is the reply message, and it does not contain the address in Reply-To.

    $ notmuch reply --reply-to=sender --format=json "id:565be5e1.X5p1I6XirRudvMa6%seaside@rmod.inria.fr" | json_pp
    {
       "reply-headers" : {
          "References" : "<565be5e1.X5p1I6XirRudvMa6%seaside@rmod.inria.fr>",
          "Subject" : "Re: [rmod] [Mm10s] 2015-11-30",
          "To" : "seaside@rmod.inria.fr",
          "From" : "Damien Cassou <damien.cassou@inria.fr>",
          "In-reply-to" : "<565be5e1.X5p1I6XirRudvMa6%seaside@rmod.inria.fr>"

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: notmuch-reply doesn't use Reply-To
  2015-12-04 16:40   ` Damien Cassou
@ 2015-12-04 17:14     ` David Bremner
  2015-12-04 17:14     ` Jani Nikula
  1 sibling, 0 replies; 11+ messages in thread
From: David Bremner @ 2015-12-04 17:14 UTC (permalink / raw)
  To: Damien Cassou, notmuch

Damien Cassou <damien@cassou.me> writes:

>
> The last sentence seems to contradict my example:
>
>     Note that the address in the Reply-To header will always appear in
>     the reply.
>

The feature, and the comment, predate the "--reply-to=sender" option so
maybe something needs to be updated.

d

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: notmuch-reply doesn't use Reply-To
  2015-12-04 16:40   ` Damien Cassou
  2015-12-04 17:14     ` David Bremner
@ 2015-12-04 17:14     ` Jani Nikula
  2015-12-29 21:54       ` Michal Sojka
  2016-03-23 10:35       ` notmuch-reply doesn't use Reply-To David Bremner
  1 sibling, 2 replies; 11+ messages in thread
From: Jani Nikula @ 2015-12-04 17:14 UTC (permalink / raw)
  To: Damien Cassou, David Bremner, notmuch

On Fri, 04 Dec 2015, Damien Cassou <damien@cassou.me> wrote:
> David Bremner <david@tethera.net> writes:
>
>> Damien Cassou <damien@cassou.me> writes:
>>
>>>                    "To" : "rmod@inria.fr",
>>>                    "Reply-To" : "rmod@inria.fr",
>>>                    "From" : "seaside@rmod.inria.fr",
>>>                    "Subject" : "[rmod] [Mm10s] 2015-11-30",
>>>                    "Date" : "Mon, 30 Nov 2015 07:00:01 +0100"
>>
>> A quick look at the code suggests this is falling victim to the
>> "reply-to munging" detection code, which considers a reply-to field
>> redudant if it duplicates one of the other fields. From the source
>>
>>     /* Some mailing lists munge the Reply-To header despite it being A Bad
>>      * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
>>      *
>>      * The munging is easy to detect, because it results in a
>>      * redundant reply-to header, (with an address that already exists
>>      * in either To or Cc). So in this case, we ignore the Reply-To
>>      * field and use the From header. This ensures the original sender
>>      * will get the reply even if not subscribed to the list. Note
>>      * that the address in the Reply-To header will always appear in
>>      * the reply.
>>      */
>
>
> The last sentence seems to contradict my example:
>
>     Note that the address in the Reply-To header will always appear in
>     the reply.
>
> Here is the reply message, and it does not contain the address in Reply-To.

This was true way back when notmuch reply only knew about reply all. For
--reply-to=sender, it's broken. The simplest "fix" might be

diff --git a/notmuch-reply.c b/notmuch-reply.c
index 6df54fc992bb..ed0f9cca5c00 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -334,7 +334,7 @@ add_recipients_from_message (GMimeMessage *reply,
      * that the address in the Reply-To header will always appear in
      * the reply.
      */
-    if (reply_to_header_is_redundant (message)) {
+    if (reply_to_header_is_redundant (message) && reply_all) {
        reply_to_map[0].header = "from";
        reply_to_map[0].fallback = NULL;
     }


BR,
Jani.

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: notmuch-reply doesn't use Reply-To
  2015-12-04 17:14     ` Jani Nikula
@ 2015-12-29 21:54       ` Michal Sojka
  2015-12-29 21:55         ` [PATCH] doc/reply: Clarify how reply-to header is handled Michal Sojka
  2016-03-23 10:35       ` notmuch-reply doesn't use Reply-To David Bremner
  1 sibling, 1 reply; 11+ messages in thread
From: Michal Sojka @ 2015-12-29 21:54 UTC (permalink / raw)
  To: Jani Nikula, Damien Cassou, David Bremner, notmuch

Hi all,

On Fri, Dec 04 2015, Jani Nikula wrote:
> On Fri, 04 Dec 2015, Damien Cassou <damien@cassou.me> wrote:
>> David Bremner <david@tethera.net> writes:
>>
>>> Damien Cassou <damien@cassou.me> writes:
>>>
>>>>                    "To" : "rmod@inria.fr",
>>>>                    "Reply-To" : "rmod@inria.fr",
>>>>                    "From" : "seaside@rmod.inria.fr",
>>>>                    "Subject" : "[rmod] [Mm10s] 2015-11-30",
>>>>                    "Date" : "Mon, 30 Nov 2015 07:00:01 +0100"
>>>
>>> A quick look at the code suggests this is falling victim to the
>>> "reply-to munging" detection code, which considers a reply-to field
>>> redudant if it duplicates one of the other fields. From the source
>>>
>>>     /* Some mailing lists munge the Reply-To header despite it being A Bad
>>>      * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
>>>      *
>>>      * The munging is easy to detect, because it results in a
>>>      * redundant reply-to header, (with an address that already exists
>>>      * in either To or Cc). So in this case, we ignore the Reply-To
>>>      * field and use the From header. This ensures the original sender
>>>      * will get the reply even if not subscribed to the list. Note
>>>      * that the address in the Reply-To header will always appear in
>>>      * the reply.
>>>      */
>>
>>
>> The last sentence seems to contradict my example:
>>
>>     Note that the address in the Reply-To header will always appear in
>>     the reply.
>>
>> Here is the reply message, and it does not contain the address in Reply-To.
>
> This was true way back when notmuch reply only knew about reply all. For
> --reply-to=sender, it's broken. The simplest "fix" might be

I don't think that this is broken for two reasons:

1. In tests/T230-reply-to-sender.sh, there is "Un-munging Reply-To"
   test, which checks the same combination of headers as in Damien's
   case and uses --reply-to=sender. The test passes and the reply has
   To=From.

2. When replying to mailing lists using reply-to munging, current
   notmuch behavior allows me to decide whether to reply 1) privately to
   the mail sender (--reply-to=sender) or 2) to the mailing list
   (--reply-to=all). The proposed change would make option 1) harder.

Therefore I suggest to fix this by applying the documentation patch from
the follow-up mail.

-Michal

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] doc/reply: Clarify how reply-to header is handled
  2015-12-29 21:54       ` Michal Sojka
@ 2015-12-29 21:55         ` Michal Sojka
  2016-03-14 23:39           ` David Bremner
  0 siblings, 1 reply; 11+ messages in thread
From: Michal Sojka @ 2015-12-29 21:55 UTC (permalink / raw)
  To: notmuch

Current documentation and comments in the code do not correspond to
the actual code and tests in the test suite ("Un-munging Reply-To" in
T230-reply-to-sender.sh). Fix it.
---
 doc/man1/notmuch-reply.rst | 6 ++++--
 notmuch-reply.c            | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/man1/notmuch-reply.rst b/doc/man1/notmuch-reply.rst
index cfbd4ea..d73f8f1 100644
--- a/doc/man1/notmuch-reply.rst
+++ b/doc/man1/notmuch-reply.rst
@@ -13,8 +13,10 @@ DESCRIPTION
 Constructs a reply template for a set of messages.
 
 To make replying to email easier, **notmuch reply** takes an existing
-set of messages and constructs a suitable mail template. The Reply-to:
-header (if any, otherwise From:) is used for the To: address. Unless
+set of messages and constructs a suitable mail template. Its To:
+address is set according to the original email in this way: if the
+Reply-to: header is present and different from any To:/Cc: address it
+is used, otherwise From: header is used. Unless
 ``--reply-to=sender`` is specified, values from the To: and Cc: headers
 are copied, but not including any of the current user's email addresses
 (as configured in primary\_mail or other\_email in the .notmuch-config
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 6df54fc..3c6d685 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -332,7 +332,7 @@ add_recipients_from_message (GMimeMessage *reply,
      * field and use the From header. This ensures the original sender
      * will get the reply even if not subscribed to the list. Note
      * that the address in the Reply-To header will always appear in
-     * the reply.
+     * the reply if reply_all is true.
      */
     if (reply_to_header_is_redundant (message)) {
 	reply_to_map[0].header = "from";
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] doc/reply: Clarify how reply-to header is handled
  2015-12-29 21:55         ` [PATCH] doc/reply: Clarify how reply-to header is handled Michal Sojka
@ 2016-03-14 23:39           ` David Bremner
  0 siblings, 0 replies; 11+ messages in thread
From: David Bremner @ 2016-03-14 23:39 UTC (permalink / raw)
  To: Michal Sojka, notmuch

Michal Sojka <sojkam1@fel.cvut.cz> writes:

> Current documentation and comments in the code do not correspond to
> the actual code and tests in the test suite ("Un-munging Reply-To" in
> T230-reply-to-sender.sh). Fix it.
> ---

pushed, sorry it took so long.

d

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: notmuch-reply doesn't use Reply-To
  2015-12-04 17:14     ` Jani Nikula
  2015-12-29 21:54       ` Michal Sojka
@ 2016-03-23 10:35       ` David Bremner
  1 sibling, 0 replies; 11+ messages in thread
From: David Bremner @ 2016-03-23 10:35 UTC (permalink / raw)
  To: Jani Nikula, Damien Cassou, notmuch

Jani Nikula <jani@nikula.org> writes:

>>
>> Here is the reply message, and it does not contain the address in Reply-To.
>
> This was true way back when notmuch reply only knew about reply all. For
> --reply-to=sender, it's broken. The simplest "fix" might be
>
> diff --git a/notmuch-reply.c b/notmuch-reply.c
> index 6df54fc992bb..ed0f9cca5c00 100644
> --- a/notmuch-reply.c
> +++ b/notmuch-reply.c
> @@ -334,7 +334,7 @@ add_recipients_from_message (GMimeMessage *reply,
>       * that the address in the Reply-To header will always appear in
>       * the reply.
>       */
> -    if (reply_to_header_is_redundant (message)) {
> +    if (reply_to_header_is_redundant (message) && reply_all) {
>         reply_to_map[0].header = "from";
>         reply_to_map[0].fallback = NULL;
>      }

I'm going to mark this fixed for now, since the docs have now been
updated to match the behaviour.

d

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-03-23 10:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-03 16:28 notmuch-reply doesn't use Reply-To Damien Cassou
2015-12-04 12:07 ` David Bremner
2015-12-04 12:14 ` David Bremner
2015-12-04 15:06   ` Tomi Ollila
2015-12-04 16:40   ` Damien Cassou
2015-12-04 17:14     ` David Bremner
2015-12-04 17:14     ` Jani Nikula
2015-12-29 21:54       ` Michal Sojka
2015-12-29 21:55         ` [PATCH] doc/reply: Clarify how reply-to header is handled Michal Sojka
2016-03-14 23:39           ` David Bremner
2016-03-23 10:35       ` notmuch-reply doesn't use Reply-To David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).