Moodle
  1. Moodle
  2. MDL-22551

Wrong "In-Reply-To" and "References" headers in mails for first post of a thread

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.8
    • Fix Version/s: 1.9.10
    • Component/s: Forum
    • Labels:
      None
    • Environment:
      probably any Moodle installation; effect becomes visible in Thunderbird/Icedove 3
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      27256

      Description

      Steps to reproduce:

      • subscribe to one or more forums
      • create some posts (new threads and replies)
      • read received mails in Thunderbird/Icedove 3
      • "View" - "Sort by" - "Threaded"

      Actual results:
      Thunderbird chooses one mail as root node (apparently the oldest forum post that is not a reply) and arranges other mails as replies below this single mail. For mailboxes with a lot of (moodle-)mails Thunderbird needs unusual long time for reordering the list. Mails for posts that are starting a new thread (thus are no replies) contain header fields like: In-Reply-To: <moodlepost0@...> and References: <moodlepost0@...>. That means all mails of thread-initiating posts are referencing the same message ID (that doesn't exist).

      Expeceted results:

      • Thunderbird's thread view of messages should represent the thread structure of the forum.
      • Mails for posts that start a new thread should not contain In-Reply-To or References headers since they are no replies or references.

      Possible solutions:

      • moodle/mod/forum/lib.php (at $userfrom->customheaders = ...) : only append In-Reply-To and References headers if the current post is a reply ($post->parent != 0)

      Although the behaviour of Thunderbird does not seem very reasonable to me, it would probably be better not to mark non-replies as replies.

        Activity

        Hide
        Matti Eiden added a comment -

        This behaviour is against RFC2822, which defines that In-Reply-To and References fields should only used when an email is a reply, otherwise those fields should not be added on the mail.

        Quote from RFC2822; 3.6.4. Identification fields:
        "The "In-Reply-To:" and "References:" fields are used when creating a reply to a message. They hold the message identifier of the original message and the message identifiers of other messages (for example, in the case of a reply to a message which was itself a reply). The "In-Reply-To:" field may be used to identify the message (or messages) to which the new message is a reply, while the"References:" field may be used to identify a "thread" of conversation.
        "

        "moodlepost0@..." is not a valid thread, and messes up some mail clients that implement threading.

        In my case the affected mail client is sup-mail.

        Show
        Matti Eiden added a comment - This behaviour is against RFC2822, which defines that In-Reply-To and References fields should only used when an email is a reply, otherwise those fields should not be added on the mail. Quote from RFC2822; 3.6.4. Identification fields: "The "In-Reply-To:" and "References:" fields are used when creating a reply to a message. They hold the message identifier of the original message and the message identifiers of other messages (for example, in the case of a reply to a message which was itself a reply). The "In-Reply-To:" field may be used to identify the message (or messages) to which the new message is a reply, while the"References:" field may be used to identify a "thread" of conversation. " "moodlepost0@..." is not a valid thread, and messes up some mail clients that implement threading. In my case the affected mail client is sup-mail.
        Hide
        Matteo Scaramuccia added a comment -

        Hi,
        https://wiki.mozilla.org/MailNews:Message_Threading#Preferences_Controlling_Threading.
        Not sure if of any help for mitigating time issues w/ Thunderbird 3.

        BTW, both 1.9 and 2.0 are affected by this issue.

        Matteo

        Show
        Matteo Scaramuccia added a comment - Hi, https://wiki.mozilla.org/MailNews:Message_Threading#Preferences_Controlling_Threading . Not sure if of any help for mitigating time issues w/ Thunderbird 3. BTW, both 1.9 and 2.0 are affected by this issue. Matteo
        Hide
        Martin Dougiamas added a comment - - edited

        Just as a quick historical note here, at the time I developed these headers (many years ago) I was using Thunderbird and the scheme we are using now was designed specifically to make things thread nicely in my client.

        Something has changed in Thunderbird since then.

        Anyway, if someone can identify some best practice here I would be very happy to fix Moodle posts.

        Is it as simple as not adding these headers for moodlepost0? or is there more to it?

        Show
        Martin Dougiamas added a comment - - edited Just as a quick historical note here, at the time I developed these headers (many years ago) I was using Thunderbird and the scheme we are using now was designed specifically to make things thread nicely in my client. Something has changed in Thunderbird since then. Anyway, if someone can identify some best practice here I would be very happy to fix Moodle posts. Is it as simple as not adding these headers for moodlepost0? or is there more to it?
        Hide
        Martin Dougiamas added a comment -

        OK, have just been looking at the 1.9 code and the fix appears rather obvious now, so I'm going to check in a change to 1.9 that only adds In-Reply-To and References to posts that actually have a parent. Thanks for the report!

        Show
        Martin Dougiamas added a comment - OK, have just been looking at the 1.9 code and the fix appears rather obvious now, so I'm going to check in a change to 1.9 that only adds In-Reply-To and References to posts that actually have a parent. Thanks for the report!
        Hide
        Martin Dougiamas added a comment -

        Fixed in 1.9 and HEAD.

        Although I'm not sure if the same headers are being used by the new messaging system - that's another issue.

        Show
        Martin Dougiamas added a comment - Fixed in 1.9 and HEAD. Although I'm not sure if the same headers are being used by the new messaging system - that's another issue.
        Hide
        Matti Eiden added a comment -

        Nice, thanks for the fix!

        I don't expect to see my university's Moodle to be updated anytime soon though, so I'll just.. try to figure a script that kills the moodlepost0 from new emails for now. Heh.

        Show
        Matti Eiden added a comment - Nice, thanks for the fix! I don't expect to see my university's Moodle to be updated anytime soon though, so I'll just.. try to figure a script that kills the moodlepost0 from new emails for now. Heh.
        Hide
        Raphael Fetzer added a comment -

        Shouldn't the References-header contain the message-id of the first post in the forum thread? Currently it contains the id of the direct parent. Matti already posted the RFC:

        'The "In-Reply-To:" field may be used to identify the message (or messages) to which the new message is a reply, while the "References:" field may be used to identify a "thread" of conversation.'

        So if the forum structure is:

        message-id#1
        -message-id#2
        -message-id#3
        --message-id#4

        The e-mail-notification about the post with message-id#4 should contain the following headers:

        Message-ID: <moodlepost4@host>
        In-Reply-To: <moodlepost3@host>
        References: <moodlepost1@host>

        While currently it includes the following headers:

        Message-ID: <moodlepost4@host>
        In-Reply-To: <moodlepost3@host>
        References: <moodlepost3@host>

        Agreed?

        Regards,
        Raphael

        Show
        Raphael Fetzer added a comment - Shouldn't the References-header contain the message-id of the first post in the forum thread? Currently it contains the id of the direct parent. Matti already posted the RFC: 'The "In-Reply-To:" field may be used to identify the message (or messages) to which the new message is a reply, while the "References:" field may be used to identify a "thread" of conversation.' So if the forum structure is: message-id#1 -message-id#2 -message-id#3 --message-id#4 The e-mail-notification about the post with message-id#4 should contain the following headers: Message-ID: <moodlepost4@host> In-Reply-To: <moodlepost3@host> References: <moodlepost1@host> While currently it includes the following headers: Message-ID: <moodlepost4@host> In-Reply-To: <moodlepost3@host> References: <moodlepost3@host> Agreed? Regards, Raphael

          People

          • Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: