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 email@example.com going to Project A and a JSD mail handler firstname.lastname@example.org going to Project B. User emails to email@example.com for a ticket created with subject "TEST 123". User then forwards same email but only to firstname.lastname@example.org with same subject "TEST 123". What happens to the 2nd forwarded email to email@example.com and why?
The Trivia, Illustrated
So here's the trivia formatted in an easy-to-understand diagram:
- User emails an email with the Subject: TEST 123 to firstname.lastname@example.org (which should create an issue in Project A)
- User then goes back to the "Sent" folder in her/his email and forwards the same sent email to email@example.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:
- 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
- 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:
Once this email is sent, a ticket will be created in Project A (with issue key = PA-101). But what if firstname.lastname@example.org 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:
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:
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:
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!
Call for comments
Let us know if there are any interesting trivia you would like to share! Comment below.
Join our public Atlassian training classes or let us build one for you
ServiceRocket built Atlassian’s first training program; we continue to closely partner with their training team to deliver on-demand training. Our collaborative approach enables IT leaders to drive software adoption, enterprise competency and the effective use of technology. An effective training program increases user adoption, improves customer success, and grows revenue for your enterprise software. Our team of certified Atlassian trainers, can help you find a program that's right for you. ServiceRocket offers: training strategy & needs assessment workshops, customized curriculum and training content development, and dedicated course delivery to help you get the most out of your Atlassian software.