Vhendin
Vhendin

Reputation: 61

Custom tags in Jira email handler

Is there a way to make a Jire email handler ignore the From field in an email and go for a custom tag instead? I know I could work with the API instead but that's in the pipe. this is a temporary solution that will be used until a more robust system is built.

To clarify what we have today:

  1. Email is sent to inbox, ([email protected])
  2. Jira picks is up and creates an issue.
  3. Jira looks at the From field and creates a uses if none exist.

What we're trying to achieve:

  1. Form is filled out, and an area is chosen (hr, facilities etc.).
  2. Form is posted to an API that creates an email (basically a no-reply adress over SMTP) and sends it to the appropriate inbox (for example [email protected]).
  3. Email lands in the inbox and Jira looks in it and creates an issue in project or label 'HR'.
  4. Jira now looks in the email and finds custom tags named [user] and [user-email] (or something) and creates a user from the tag.


Example email

From: [email protected]

To: [email protected]

Subject: Some problem

Body: Explanation of problem

Have a good day!

/Mike

[user:"Michael Smith"]

[userEmail:"[email protected]"]


If we were to implement this system now, we would loose the possibility to create new users because all emails would come from the same "no-reply" adress.

I have searched in the Atlassian forums and such, but with no luck. Have not found anything in the official documentation, but I fear that I might be looking in the wrong place.

I hope that I'm being clear, and that someone has any idea if it is possible.

Thank you!

Upvotes: 0

Views: 168

Answers (1)

Lama
Lama

Reputation: 2964

You need to write your own plugin and create your own Mailhandler.

For example you can use a regex which looks for the tag [userEmail:"[email protected]"] and retrieve the emailadress from the string. Do the same for the [user]-tag, if the user doesn't exist.

Here is a tutorial that shows how to create and setup custom Message Handlers:

https://developer.atlassian.com/jiradev/jira-platform/guides/email/tutorial-custom-message-mail-handler-for-jira#Tutorial-Custommessage(mail)handlerforJIRA-Step7:Implementarealmessagehandlerback-end

The rest should be easy from here.

Upvotes: 1

Related Questions