Documentation for JIRA 5.2. Documentation for other versions of JIRA is available too. 
![]()
JIRA generates emails in reaction to events using a templating engine. The templating engine is Apache's Velocity. This is a relatively easy to use templating language that can pull apart java objects in useful ways. The mails are generated inside JIRA by invoking Velocity with a set of objects of relevance to the event.
Please Note:
Customisations to Velocity templates or other JIRA files are not included in the scope of Atlassian Support.
To customise email content, please follow this procedure.
WEB-INF/classes/templates/email/ of the <jira-application-dir> in your JIRA Installation Directory. jira/src/etc/java/templates/email/ in your extracted JIRA source directory.html, text and subject. The html subdirectory contains the templates used to create emails in html, while the text directory the plain text mail outs. The subject directory contains the templates used to generate the subject of the emails. The templates are named after the event that will trigger the email.For new email templates:
mytemplate.vm files in the html, text and subject directories, based on the existing files in those directoriesatlassian-jira/WEB-INF/classes/email-template-id-mappings.xml to make them valid choices for when you are adding a new event.Note that since JIRA 4.1 each new template has to have a corresponding file in the subject directory.
The Issue object is passed into the vm templates. Notice some of its implementation in /includes/summary-topleft.vm. As an example, calling $issue.getProject() would allow you to determine the project an issue comes from, and even create logic to show different information for emails from different projects.
In a development instance, you can play with picking up velocity file changes without a restart.
From <jira-install>/atlassian-jira/WEB-INF/classes/velocity.properties:
class.resource.loader.cache from true to false#) from #velocimacro.library.autoreload=trueMaking this change in production will eventually lead to JIRA not serving pages along with the ran out of parsers error in the log file.
See also Adding Custom Fields to Email.
1 Comment
user-7606f
May 06, 2013I've followed this step-by-step (and restarted 2x) and the new Template does not show up in my dropdown of available templates. Is there a naming convention? What is the <templatetype> field in the email-template-id-mappings.xml looking for? Does the <templatemapping id> need to be registered somewhere or can I just take the next one in the sequence?
<templatemapping id="17">
<name>Outage Notification</name>
<template>outagenotification.vm</template> <–---in subject, html and text folders
<templatetype>outagenotification</templatetype> <—is this right if all my .vm's are named accordingly?
</templatemapping>