<para>
When replying to messages, the <emphasis>In-Reply-To:</emphasis> header contains the
-Message-Id of the message(s) you reply to. If you remove its value, Mutt will not generate a
+Message-Id of the message(s) you reply to. If you remove or modify its value, Mutt will not generate a
<emphasis>References:</emphasis> field, which allows you to create a new message thread, for example
to create a new message to a mailing list without having to enter the mailing list's address.
</para>
safe_fclose (&ifp);
mutt_unlink (path);
+ /* in case the user modifies/removes the In-Reply-To header with
+ $edit_headers set, we remove References: as they're likely invalid;
+ we can simply compare strings as we don't generate Refereces for
+ multiple Message-Ids in IRT anyways */
+ if (!n->in_reply_to || (msg->env->in_reply_to &&
+ mutt_strcmp (n->in_reply_to->data,
+ msg->env->in_reply_to->data) != 0))
+ mutt_free_list (&msg->env->references);
+
/* restore old info. */
mutt_free_list (&n->references);
n->references = msg->env->references;
mutt_free_envelope (&msg->env);
msg->env = n; n = NULL;
- if (!msg->env->in_reply_to)
- mutt_free_list (&msg->env->references);
-
mutt_expand_aliases_env (msg->env);
/* search through the user defined headers added to see if