How to create custom email templates in JIRA?

Hi,

I am trying to create a custom email template. I have modified the email-template-id-mappings.xml file as follows:

<templatemapping id="18">

<name>HR Issue Resolved</name>

<template>hrissueresolved.vm</template>

<templatetype>issueevent</templatetype>

</templatemapping>

I have created the hrissueresolved.vm file under the subject and html folders on the server. NOTE: I have not created this file under the text folder as we only use html emails.

I have added a new event called "HR Issue Resolved" to Events in JIRA. I have modified our workflow so that this event is fired when an issue is resolved.  I have restarted JIRA. When I tested our workflow, I do not receive any email.

Can anyone please help me out? Thanks!

2 answers

questions:

  • JIRA version?
  • cloud or server?
  • contents of mail queue during/after you trigger event?
  • have you tested using a pre-existing template? (remove your velocity prowess from equation)
  • contents of atlassian-jira.log and the mail log (like pages of stack traces)

-wc

 

JIRA 6.3.15 Server The new email template is based off the issueresolved.vm template. I know it works because if I directly modify the issueresolved.vm template and fire the "Issue Resolved" event when my issue closes, I do get an email and with the modified contents I am expecting. So I know the template is correct. Thanks.

Yes, this is part of why customizing JIRA email templates is harder than it feels like it should be. Test with an unmodified copy of issueresolved,vm in hrissueresolved.vm. Make sure the transition is using your custom event and has been published. Make sure your issue is of the right type to be using the workflow. Once all that is working then start modifying the velocity template one small change at a time. You can use velocity.properties to not have to restart JIRA for every change. Then be ready to test hrissueresolved.vm at every upgrade. Are you sure you really need a new template? I generally encourage people to click on the View Issue link in email whenever I can

thanks Matt - I'd make that the answer

@Andrew Ting - also have the jira mail queue up so you can see if anything is generated to be sent. I strongly suspect that nothing is getting to the queue tho, which indicates a config problem (workflow published?) or problems in the velocity. -wc

Hi All, thanks for your responses. I copied the existing issueresolved.vm and renamed it hrissueresolved.vm to eliminate any VM errors. It still doesn't work. It seems that JIRA can't pick up the mapping I've added to the email mapping xml file. It doesn't recognize it at all. I checked the mail queue and no email is coming through. So for now I've just decided to edit the existing vm template files and use an if-statement. Thanks again. Andrew.

updated answer with better questions

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

24,866 views 2 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you