Search

How can we help?

Contact our Solutions team

Back

Contact our Apps team

Back
Back

Click here to chat with our
support team now

Back
How Jira REALLY Handles Incoming Mails (This will surprise you!)
Foogie Sim
Manager, Solution Management
Share this article

Recently, one of our consultants here in ServiceRocket created this Trivia game to help us understand how Jira handles incoming emails. He posted the question in our Internal Workplace (In case you are curious: we communicate internally via Facebook's Workplace).

Question: I have a mail handler trivia for everyone. Winner gets bragging rights for the day! Cloud is configured with Jira mail handler jira@cloud.com going to Project A and a JSD mail handler jsd@cloud.com going to Project B. User emails to jira@cloud.com for a ticket created with subject "TEST 123". User then forwards same email but only to jsd@cloud.com with same subject "TEST 123". What happens to the 2nd forwarded email to jsd@cloud.com and why?

Screen Shot 2018-12-03 at 3.29.48 PM

The Trivia, Illustrated

So here's the trivia formatted in an easy-to-understand diagram:

Screen Shot 2018-12-10 at 16.48.49

Steps:

  1. User emails an email with the Subject: TEST 123 to jira@cloud.com (which should create an issue in Project A)
  2. User then goes back to the "Sent" folder in her/his email and forwards the same sent email to jsd@cloud.com (which is linked to Project B)

What is NOT Going To Happen?

Most people would think that the second email would be created as a new issue in Project B, because:

  1. Based on Jira's documentation: "If the subject contains an issue key, the message is added as a comment to that issue. If no issue key is found, a new issue is created in the default project.". In this case, the subject is TEST 123 for both emails, which does not contain any Issue Key
  2. Both emails are sent to separate mail handlers linked to 2 different Projects. (and especially so, considering Project A is most probably a Jira Core/Software project, versus Project B's JSD project)

This is however, the wrong answer for this trivia.

What's The Correct Answer?

The correct answer is a bit tough to figure out, and requires some digging to reveal this clue: https://jira.atlassian.com/browse/JRASERVER-30293

JRASERVER-30293 was a bug quite some time ago in Jira; when Jira would create "duplicate" issues if a person forwards the same email that was originally sent to create an issue. Consider the following email:

Screen Shot 2018-12-03 at 4.08.09 PM

Once this email is sent, a ticket will be created in Project A (with issue key = PA-101). But what if john@doe.com replies to the same email (with Subject: "Help Needed")? Should Jira create another ticket, PA-102 for that email simply because the Subject in the email lacked the original issue key, PA-101?

The Message-ID and the In-Reply-To

The developers then decided to cater for this scenario by using the email's Message-ID. What is Message-ID and how does it look like? Here's an example from the email we sent:

Screen Shot 2018-12-10 at 16.49.38

When Jira receives this email, an issue will be created and the Message-ID value from the email will be stored in Jira. This is used to compare subsequent emails to see if there are any matching Message-ID, which can then be used to detect replies to existing issues that do not have any Issue keys in its title.

So any replies/forwards of this particular email, will look like the following:

Screen Shot 2018-12-10 at 16.49.52

Jira will then detect that the In-Reply-To value matches the Message-ID of the issue created in Project A, and adds it as a reply to the issue.

This is all pretty cool and all, but shouldn't Jira ignore all that considering both Projects are listening on 2 completely different emails?

Email Aliasing in Cloud

When it comes to Jira ServiceDesk on Cloud, we have to realise that the email address we can setup in each JSD Project are merely aliases of the main email address, and not an actual mail account in itself. This means that all emails sent to these JSD addresses would first pass through the main mail handler. So in a sense, my diagram above can be improved to better reflect the reality, which is this:

Screen Shot 2018-12-10 at 16.50.09

Voila! And that, ladies and gentlemen, is how Jira REALLY handles Incoming Mails. Let me know in the comments down below if you find any mistakes I may have made in my investigation here, and if you have other interesting trivia you would like to share, or test us on!


OUR SERVICES

Build expert proficiency faster with ServiceRocket's Atlassian Training

GET TRAINING
<-- Facebook Share Button Code --> <-- Facebook Share Button Code --> <-- Twitter Share Button Code --> <-- Twitter Share Button Code --> <-- Linkedin Share Button Code --> <-- Linkedin Share Button Code -->