How to maintain email threads in Jira

Problem

Email threads or chains are important for keeping track of conversations and properly represent them in Jira as issues and their comments.

By default, an email thread is maintained using 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 of the emails by the email server that dispatches them.

Consider the following 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 Generation 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.

Solution

In version 9.1.0, we introduced a fix that made maintaining email threads simpler. If you already use the solution provided for the earlier version, do not remove it from your handler, until all the existing email threads are finished (i.e. 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 threads, do the following:

1. Go to INCOMING EMAILS --> Mail Accounts.

2. Click the three dots next to the mail account you want to modify, and choose Configure.

3. Add the Find issues by references in email headers option to the Find Issues for Email section. After this, your email threads will be automatically maintained.

If you are migrating your Classic Mail Handlers to Next Generation Mail Handlers, and you use the Find issues by references in email headers option, your already existing email threads will be maintained even after the migration.

Read more:

Classic Mail Handlers

Next Generation Mail Handlers

Migrating Next Generation Mail Handlers

Before version 9.1.0

Important: 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 won't be applicable and this scenario won't work. In this case, including the issue-key in the subject is a must.

Do the following to keep track of the email chain via message IDs:

1. Add three text custom fields to Jira. Call them something like: “Message ID”, “References”, and “In Reply To”.

2. Configure your Next Generation Mail Handlers to save message IDs into these custom fields and to look up issues based on the message IDs.

Result: Your handler now should include the parts highlighted in the following image.

Note: You can name the custom fields differently. In this case adjust the JQL statements accordingly.

The handler attempts 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 behavior in most of the cases.

Last updated