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 firstname.lastname@example.org going to Project A and a JSD mail handler email@example.com going to Project B. User emails to firstname.lastname@example.org for a ticket created with subject "TEST 123". User then forwards same email but only to email@example.com with same subject "TEST 123". What happens to the 2nd forwarded email to firstname.lastname@example.org and why?
So here's the trivia formatted in an easy-to-understand diagram:
Most people would think that the second email would be created as a new issue in Project B, because:
This is however, the wrong answer for this trivia.
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 email@example.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 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?
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!
Build expert proficiency faster with ServiceRocket's Atlassian Training.