NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      When replying to an e-mail that was sent to create a JIRA issue, instead of adding a comment to the related issue, as it should according to this documentation, the reply e-mail is creating a new JIRA issue.
      As he does not find the JIRA Issue Key in the e-mail subject, he should check the in-reply-to header of the e-mail to see if the first e-mail of the chain created an issue, and it seems the system is not doing that.

      Steps to reproduce

      1. Send an e-mail to create and issue with a Cc to yourself or another e-mail.
        1. This e-mail has the example ID: 1234
      2. Wait for the issue to be created.
        1. JIRA replies with an e-mail that has the example ID: ABCD
      3. Now, using the CC address, just reply the email with ID: 1234 that created the issue.

      The handler is not following the In-reply-to ID.

      Expected behavior - The reply should be added as a comment to the issue.
      Actual behavior - The reply is creating a new issue. (Duplicated one)

          Form Name

            [JRASERVER-30293] Duplicating issue when replying to e-mail

            Mas Jaya added a comment -

            Hi Michael,

            Can we set create user is false?

            Cheers

            Mas Jaya added a comment - Hi Michael, Can we set create user is false? Cheers

            Which Email handler should I be using to avoid this

            Thanks
            Mamdouh Elbittar

            Mamdouh Elbittar added a comment - Which Email handler should I be using to avoid this Thanks Mamdouh Elbittar

            Hi @Michael Andreacchio,

            We have JIRA SD v7.1.7 and we can still this issue happening , I can provide a test case if needed.

            Thanks
            Mamdouh Elbittar

            Mamdouh Elbittar added a comment - Hi @Michael Andreacchio, We have JIRA SD v7.1.7 and we can still this issue happening , I can provide a test case if needed. Thanks Mamdouh Elbittar

            when i testing ,

            Dr X then changes the subject of the email, this results in not a new issue (ISSUE-2), Just a comment in that issue (ISSUE-1)

            Jabari Deng added a comment - when i testing , Dr X then changes the subject of the email, this results in not a new issue (ISSUE-2), Just a comment in that issue (ISSUE-1)

            Michael Andreacchio added a comment - - edited

            Hey guys, we've tested this again, this time with the details:

            • Created an incoming IMAP Gmail server
            • Create a handler "Create a new issue or add a comment to an existing issue" with the properties:
              • Strip Quotes: false
              • Create Users: true
              • Notify Users: true
              • CC Assignee: true
              • CC Watchers: false
            • Emailed JIRA and also sent to another recipient (Dr X)
            • JIRA created a new issue ISSUE-1
            • Dr X then replies All to that email, it then comes up as a comment in that issue (ISSUE-1)
            • Dr X then changes the subject of the email, this results in a new issue (ISSUE-2)
            • Dr X then copies the subject exactly, and puts it into a new email and sends it to JIRA - this creates a new issue (ISSUE-3)

            Interesting! Let me know if anything else is needed on this.

            This seems to be working correctly

            Michael Andreacchio added a comment - - edited Hey guys, we've tested this again, this time with the details: Created an incoming IMAP Gmail server Create a handler "Create a new issue or add a comment to an existing issue" with the properties: Strip Quotes: false Create Users: true Notify Users: true CC Assignee: true CC Watchers: false Emailed JIRA and also sent to another recipient (Dr X) JIRA created a new issue ISSUE-1 Dr X then replies All to that email, it then comes up as a comment in that issue (ISSUE-1) Dr X then changes the subject of the email, this results in a new issue (ISSUE-2) Dr X then copies the subject exactly, and puts it into a new email and sends it to JIRA - this creates a new issue (ISSUE-3) Interesting! Let me know if anything else is needed on this. This seems to be working correctly

            Panna (Inactive) added a comment - - edited

            I tested using Gmail too, and followed the testing note suggested by Mark and it worked.

            Tried to contact mandreacchio, he is on leave right now.

            Panna (Inactive) added a comment - - edited I tested using Gmail too, and followed the testing note suggested by Mark and it worked. Tried to contact mandreacchio , he is on leave right now.

            bgingold1 AFAIK it is fixed.

            I tested it during development, it passed QA before it was released, and then I downloaded 5.2.2 and tested again after Andy's comment.
            Andy retested and admitted he could not reproduce.
            mandreacchio claims he can repro but has not yet provided full instructions.

            Perhaps there is some more subtle bug that only fails some times?
            Or perhaps there was a flaw in the testing?
            Perhaps they weren't using the standard CreateOrCommentHandler (custom handlers could also suffer this)?

            This original bug report was easily reproducible 100% of the time (you can try it out for yourself by following the steps in the description or my comment above), and so even if these guys have seen a legitimate bug, it would be a different bug that should be raised separately.

            maybe just with Gmail?

            Gmail was the client I used for testing and it worked.

            Mark Lassau (Inactive) added a comment - bgingold1 AFAIK it is fixed. I tested it during development, it passed QA before it was released, and then I downloaded 5.2.2 and tested again after Andy's comment. Andy retested and admitted he could not reproduce. mandreacchio claims he can repro but has not yet provided full instructions. Perhaps there is some more subtle bug that only fails some times? Or perhaps there was a flaw in the testing? Perhaps they weren't using the standard CreateOrCommentHandler (custom handlers could also suffer this)? This original bug report was easily reproducible 100% of the time (you can try it out for yourself by following the steps in the description or my comment above), and so even if these guys have seen a legitimate bug, it would be a different bug that should be raised separately. maybe just with Gmail? Gmail was the client I used for testing and it worked.

            @mlassau, @mandreacchio, is this issue indeed resolved in JIRA 5.2.3 and later? Some of your comments suggest there may still be a problem, maybe just with Gmail? Thanks!

            Brian Gingold added a comment - @mlassau, @mandreacchio, is this issue indeed resolved in JIRA 5.2.3 and later? Some of your comments suggest there may still be a problem, maybe just with Gmail? Thanks!

            mandreacchio Can you please provide more detailed instructions.
            Or grab me and show me what you did?

            Mark Lassau (Inactive) added a comment - mandreacchio Can you please provide more detailed instructions. Or grab me and show me what you did?

            Michael Andreacchio added a comment - - edited

            Hi Guys,

            Just tested this on JIRA 5.2.4. Created an issue, set the assignee that it was mailed to. In mail reply from the assignee changed the subject, a brand new issue was created.

            Cheers,

            Michael

            Michael Andreacchio added a comment - - edited Hi Guys, Just tested this on JIRA 5.2.4. Created an issue, set the assignee that it was mailed to. In mail reply from the assignee changed the subject, a brand new issue was created. Cheers, Michael

            Yes, was using CreateOrCommentHandler, I've now redone tests, and it's doing exactly what it should, can't think what I did differently previously, sorry for chaff, </ignore>

            Andy Brook (Javahollic Software) added a comment - Yes, was using CreateOrCommentHandler, I've now redone tests, and it's doing exactly what it should, can't think what I did differently previously, sorry for chaff, </ignore>

            Hi Mark, curious, I followed you exact steps and came up with a new issue (using Gmail).

            I am using GMail too!

            Are you using the standard JRIA CreateOrCommentHandler?
            Or are you using JEMH?

            Mark Lassau (Inactive) added a comment - Hi Mark, curious, I followed you exact steps and came up with a new issue (using Gmail). I am using GMail too! Are you using the standard JRIA CreateOrCommentHandler? Or are you using JEMH?

            Hi Mark, curious, I followed you exact steps and came up with a new issue (using Gmail).

            k, will check.

            Andy Brook (Javahollic Software) added a comment - - edited Hi Mark, curious, I followed you exact steps and came up with a new issue (using Gmail). k, will check.

            javahollic
            The way this works is that we store the incoming Message-ID from the first incoming email, then we look for a "In-Reply-To" with that Message-ID on the second email.

            So it won't work if the first email was sent before the upgrade to JIRA 5.2.3 because it is too late - we already failed to store the Message-ID.

            Is it possible this issue may have been mistakenly closed as being related to the reply-to threading change?

            No. One of Eric's comments mixed the two up, but this bug was definitely fixed.

            Looking at the mail handler code there doesn't seem to be anything at that level that indicates this has been implemented.

            Look at AbstractMessageHandler.recordMessageId() and also the changes in MailThreadManagerImpl.

            Mark Lassau (Inactive) added a comment - javahollic The way this works is that we store the incoming Message-ID from the first incoming email, then we look for a "In-Reply-To" with that Message-ID on the second email. So it won't work if the first email was sent before the upgrade to JIRA 5.2.3 because it is too late - we already failed to store the Message-ID. Is it possible this issue may have been mistakenly closed as being related to the reply-to threading change? No. One of Eric's comments mixed the two up, but this bug was definitely fixed. Looking at the mail handler code there doesn't seem to be anything at that level that indicates this has been implemented. Look at AbstractMessageHandler.recordMessageId() and also the changes in MailThreadManagerImpl.

            In my testing with 5.2.4 (download) this doesn't seem to be implemented.

            I just downloaded 5.2.4 and confirmed that it works as expected.

            Steps:

            • Create Incoming mail handler "Create a new issue or add a comment to an existing issue"
            • Send an email to JIRA's address as well as another address
            • Reply directly to incoming email (not from JIRA notification)
              Outcome: the reply email was added as a comment, not a new issue.

            Mark Lassau (Inactive) added a comment - In my testing with 5.2.4 (download) this doesn't seem to be implemented. I just downloaded 5.2.4 and confirmed that it works as expected. Steps: Create Incoming mail handler "Create a new issue or add a comment to an existing issue" Send an email to JIRA's address as well as another address Reply directly to incoming email (not from JIRA notification) Outcome: the reply email was added as a comment, not a new issue.

            There are commits against this issue in particular :/ I guess it's possible that this issue was misinterpreted.

            mlassau, could you shed some light on this?

            Eric Dalgliesh added a comment - There are commits against this issue in particular :/ I guess it's possible that this issue was misinterpreted. mlassau , could you shed some light on this?

            Hi Eric, I can raise a new issue but as far as I can tell this is the same issue. The changes you mentioned regarding threading relate to replies to notifications that JIRA has issued, this issue relates to replies to the original issue-creating email (so it can't associate with an issue via reply-to header because the reply-to header hasn't yet been set by JIRA yet).

            Is it possible this issue may have been mistakenly closed as being related to the reply-to threading change?

            Andy Brook (Javahollic Software) added a comment - Hi Eric, I can raise a new issue but as far as I can tell this is the same issue. The changes you mentioned regarding threading relate to replies to notifications that JIRA has issued, this issue relates to replies to the original issue-creating email (so it can't associate with an issue via reply-to header because the reply-to header hasn't yet been set by JIRA yet). Is it possible this issue may have been mistakenly closed as being related to the reply-to threading change?

            Hi javahollic,

            Yes, this should be fixed in 5.2.4. The main changes are in a separate library we use for mail handling. If you're still seeing this issue or similar issues, could you create a new bug outlining what's happening? The more information you can provide about your environment, the better (which mail server you use, which client, and what headers are being sent are all useful).

            Please note that in some circumstances new mail will not thread properly with old mail after upgrading as the way it is handled has changed.

            Regards,
            Eric

            Eric Dalgliesh added a comment - Hi javahollic , Yes, this should be fixed in 5.2.4. The main changes are in a separate library we use for mail handling. If you're still seeing this issue or similar issues, could you create a new bug outlining what's happening? The more information you can provide about your environment, the better (which mail server you use, which client, and what headers are being sent are all useful). Please note that in some circumstances new mail will not thread properly with old mail after upgrading as the way it is handled has changed. Regards, Eric

            Hello,
            In my testing with 5.2.4 (download) this doesn't seem to be implemented. Is it supposed to be/will it be? Looking at the mail handler code there doesn't seem to be anything at that level that indicates this has been implemented. The reason I ask I've just implemented this for JEMH...

            Andy Brook (Javahollic Software) added a comment - Hello, In my testing with 5.2.4 (download) this doesn't seem to be implemented. Is it supposed to be/will it be? Looking at the mail handler code there doesn't seem to be anything at that level that indicates this has been implemented. The reason I ask I've just implemented this for JEMH...

            Mark Lassau (Inactive) added a comment - - edited

            Testing Notes:

            Please test the following scenarios:
            1)

            • User A emails JIRA and user B.
            • User B does a "reply all" to A and JIRA
              In this case we expect the email from B to be added as a comment to the issue created by the email from A

            2)

            • User A emails JIRA and user B.
            • User B does a "reply all" to A and JIRA
            • User A does a "reply all" to B and JIRA
              In this case we expect the second email from A to be added as another comment to the issue created by the first email from A

            Mark Lassau (Inactive) added a comment - - edited Testing Notes: Please test the following scenarios: 1) User A emails JIRA and user B. User B does a "reply all" to A and JIRA In this case we expect the email from B to be added as a comment to the issue created by the email from A 2) User A emails JIRA and user B. User B does a "reply all" to A and JIRA User A does a "reply all" to B and JIRA In this case we expect the second email from A to be added as another comment to the issue created by the first email from A

            Further investigation shows a second bug.
            This one is possibly JDBC driver dependant (due to rounding of milliseconds) but it occurs for me on Oracle.

            This bug causes even replies to notifications from JIRA to be added as an issue instead of a comment if the Issue key is not included in the email subject.
            This one would only occur if either:

            • The user had edited the email template and changed the subject (not possible on JoD??)
            • the sender had intentionally edited the subject of the reply to remove the issue key (not likely)

            Mark Lassau (Inactive) added a comment - Further investigation shows a second bug. This one is possibly JDBC driver dependant (due to rounding of milliseconds) but it occurs for me on Oracle. This bug causes even replies to notifications from JIRA to be added as an issue instead of a comment if the Issue key is not included in the email subject. This one would only occur if either: The user had edited the email template and changed the subject (not possible on JoD??) the sender had intentionally edited the subject of the reply to remove the issue key (not likely)

            I have investigated this today, and I can replicate in BTF and OnDemand.
            This is a design limitation of the changes made for JRA-9979

            The bug occurs under the following scenario:

            • User Amanda emails JIRA and user Bob in one email
            • Bob replies directly to Amanda's email using "Reply All"

            Bob's email will create a new Issue instead of adding a comment to the issue created in response to Amanda's email.

            Note that if Bob had instead replied to the notification from JIRA about the creation of the original email, then the comment is created as expected.

            Mark Lassau (Inactive) added a comment - I have investigated this today, and I can replicate in BTF and OnDemand. This is a design limitation of the changes made for JRA-9979 The bug occurs under the following scenario: User Amanda emails JIRA and user Bob in one email Bob replies directly to Amanda's email using "Reply All" Bob's email will create a new Issue instead of adding a comment to the issue created in response to Amanda's email. Note that if Bob had instead replied to the notification from JIRA about the creation of the original email, then the comment is created as expected.

            Mark Lassau (Inactive) added a comment - - edited

            I am starting to look at fixing the bug today.

            In the meantime, it seems from the reports that it is only the StudioEmailHandler that is buggy.
            EDIT: Looking closer at the report, I don't think that this is the case.

            Mark Lassau (Inactive) added a comment - - edited I am starting to look at fixing the bug today. In the meantime, it seems from the reports that it is only the StudioEmailHandler that is buggy. EDIT: Looking closer at the report, I don't think that this is the case.

              edalgliesh Eric Dalgliesh
              pvieira Paulo Vieira
              Affected customers:
              4 This affects my team
              Watchers:
              16 Start watching this issue

                Created:
                Updated:
                Resolved: