Examples: Customizing email content
Here are some examples of how to modify default email templates. For information on existing template types and how they are configured in Jira, check out these guides:
Adding customized onboarding instructions
Template: usersignup.vm
More about templates: Templates: Batched issue notifications and other events, Templates: Separate issue notifications and other events
The usersignup.vm
template controls notifications sent to new users. You can add your onboarding instructions or external links somewhere before the footer, as shown in this example:
#rowWrapperNormalBegin()
<Your onboarding instructions>
#rowWrapperNormalEnd()
#parse("templates/email/html/includes/footer.vm")
Adding company logo
Template: any, most commonly footer.vm
or header.vm
More about templates: Templates: Batched issue notifications and other events, Templates: Separate issue notifications and other events
To add a logo:
Add the image file to the ZIP archive you downloaded from Jira. You should create a new folder for it at the top of the hierarchy, next to email and email-batch.
Refer to the image file in your templates. Jira will send the image together with notifications.
<img src="/images/logo.png">
Showing issue’s URL instead of content
Template: Issue notifications templates (batched and separate)
More about templates: Templates: Batched issue notifications and other events, Templates: Separate issue notifications and other events
Use the following snippet to generate a URL to your issue. In this URL, the issue summary will be displayed as URL’s text. If you don’t want to reveal the summary, you can change it to something else.
<a href='${baseurl}/browse/${issue.getKey()}'>$textutils.htmlEncode($issue.getSummary())</a>
Once you have the URL, use it in one of the templates for issue notifications. For example, if you wanted to modify issuecreated.vm
, you’d have to replace its content with the following snippet:
#disable_html_escaping()
#defaultMailHeader("email.event.activity.created.issue", $issue.reporter)
#set($link ="<a href='${baseurl}/browse/${issue.getKey()}'>$textutils.htmlEncode($issue.getSummary())</a>")
#rowWrapperNormal($link)
#parse("templates/email/html/includes/footer.vm")
Displaying conditional content based on security level
Template: Issue notifications templates (batched and separate)
More about templates: Templates: Batched issue notifications and other events, Templates: Separate issue notifications and other events
To display conditional content:
Add the following Velocity snippet to define the name of your security level:
#if ($issue.securityLevel) #(set($issueSecurityLevel = $issue.securityLevel.getString(“name”)) … #end
Display your content if the issue matches the defined security level:
#if($issueSecurityLevel == "My Security Level") The content you'd like to display for this security level. #end