Maintain Email Chains (Email Threads) in Jira

Email Chains are important to keep track of email conversations and properly represent them in Jira as issues and its comments.

By default the email chain is maintained via the issue key appearing in the subject. If this is not possible, we can only rely on message ids.

Message IDs are unique identifiers set in the header part of the emails by the email server that dispatches them.

The following is a typical situation.

  1. Anne sends email to Bill and Corp, where Corp is the mail account from which Jira processes the emails. The email does not contain any reference to an issue.

  2. The issue is created in Jira by our Next Gen Mail Handler

  3. Bill receives the email and uses the Reply All function of his mailer app to send a reply to Anne and implicitly to Corp as well, since Corp was on the original email.

  4. The reply email reaches Anne and Jira, but as it lacks any valid issue ID, normally a new issue is created. The preferred solution was to save Bill’s response as a comment in the issue created from Anne’s email.

This is a problem and causes confusion in many cases. Follow the below descriptions for a solution.

Instructions

In version 9.1.0 we introduced a fix that made maintaining email chains a lot more simple. If you already use the solution provided for the earlier version, do not remove it from your handler, until all the existing email chains are finished (when you do not expect any more replies to them). The removal can cause existing email chains to break, and new issues will be created for follow-up emails.

After version 9.1.0

To maintain email chains you just have to add the Find issues by references in email headers option to the Find Issues for Email section. After this, your email chains will be automatically maintained.

If you migrating your https://metainf.atlassian.net/wiki/spaces/PLUG/pages/436568116 to https://metainf.atlassian.net/wiki/spaces/PLUG/pages/436469838 , and you use the aforementioned Find issues by references in email headers option, your already existing email chains will be maintained even after the migration.

Before version 9.1.0

Please note that some email service providers do not include a message-id in their outgoing emails. If the original email does not have a message-id, the following guide will not be applicable and this scenario will not be working. In this case, including the issue-key in the subject is a must.

Here is a list of steps to follow and to keep track of the email chain via message IDs

  1. Add 3 text custom fields to Jira, call them anything like “Message ID”, “References”, “In Reply To”

  2. Configure your https://metainf.atlassian.net/wiki/spaces/PLUG/pages/436469838 to save message IDs into these custom fields and to look up issues based on the message IDs.

Your handler should include the highlighted parts.

You may call the custom fields differently, in this case adjust the JQL statements accordingly.

As a result, the handler will attempt to find issues by extracting message IDs from the “References” or “In-Reply-To” email headers of the reply emails. If found, the reply mail’s body is added as a comment which is the desired behaviour in most of the cases.