Email This Issue
📈 Marketplace❓ Support❤️ Feedback🏠 META-INF Apps
Email This Issue - for Jira Cloud
Email This Issue - for Jira Cloud
  • ⬇️Overview
  • Email This Issue - for Jira Cloud
  • Features
  • How Email This Issue Works
  • Secure the email channel with Email This Issue
  • Comparing Email This Issue and Jira Cloud
  • 📤Outgoing Emails
    • Outgoing emails overview
    • Manual emails
      • Configuring manual emails
      • Sending manual emails
    • Email notification schemes and email notifications
    • Workflow post functions
    • Advanced email configuration
    • Customizing email templates
    • Canned Responses (default messages)
    • Scope evaluation
  • 📥Incoming Emails (Mail Handlers)
    • Incoming emails overview
  • Mail handlers - adding / editing
    • General handler settings
    • Filtering
    • Finding issues
    • Setting up rules and actions in the actions editor
      • Adding/editing actions
      • Adding recipients to Request Participants
      • Creating an issue
      • Updating an issue
      • Setting field values
      • Adding comments
      • Sending auto-reply emails
      • Executing workflow transitions
      • Creating a customer
      • Using split regexp
      • Conditions
      • Approve request
      • Decline request
    • Maintaining email chains
    • Mail Handler New UI
  • Global Sender Address Filters
  • Attachment Filters
    • Regular Attachment Handling Deprecation
  • 🤓Administration
    • Outgoing Mail Connections
    • Alerting via Webhooks
      • Webhooks
        • Configuring Slack to receive alerts via webhooks
        • Configuring OpsGenie to Receive alerts via webhooks
        • Configuring Microsoft Teams to receive alerts via webhooks
      • Webhook execution logs
    • Mail Queue
    • Email Audit Log
    • Permissions
    • Recipient Restrictions
    • Incoming Mail Connections
    • Email Security
    • Incoming Mail Queue
    • Incoming Mail Log
    • OAuth2 Credentials
      • Enabling OAuth2 Authorization in your Google Account
      • Enabling OAuth2 Authorization in your Microsoft 365 Account
      • Troubleshooting guides for Microsoft OAuth2 Connections
        • How to fix "BAD User is authenticated but not connected" error​
        • How to fix "401 Unauthorized" error
        • How to fix "key expires_in " error
        • How to fix "Need admin approval" error
  • ☁️Server to Cloud Migration
    • 🛫Server to Cloud - Automatic Migration tool
      • Preparing for the migration
      • Doing the migration
      • Finalizing the migration in Cloud
      • Migration with unsupported Jira versions causes errors
    • Server to Cloud - Manual migration guide for Email This Issue
  • ❓FAQ
    • No recipients error in outgoing emails
    • How-to add custom macro to email Template?
    • Why cannot I select custom event types in notification?
    • How to configure the Email This Issue addon user in Jira Cloud?
    • I get an error: Could not create request on behalf of the sender
    • Why is the Incoming Mail Queue size limited?
    • Outgoing mail not sent - Read timeout error
    • Access restriction icon is not appearing when adding internal attachments via Email this Issue
  • 🌪️General
    • Release Notes
    • API
      • API for Velocity Context Objects - 1.7
      • API for Velocity Context Objects
    • Addon Pages
      • Integrity Check
      • Feedback and Support
    • Security Advisories
      • Email This Issue Security Advisory September 28, 2020
    • Appendix
      • Supported Time Zones
    • Integration of Glass Documentation
Powered by GitBook
On this page
  • Themes
  • Building email templates
  • Setting up Basic Settings
  • Setting up the Subject Template
  • Setting up the HTML Template
  • Embedding images
  • Setting up the Text Template
  • Using the Field Picker
  • Velocity Context for Templates
  • Velocity Macros
  • Assets related macros
  • Concatenating text to URLs
  • Template operations
  • Testing templates

Was this helpful?

  1. Outgoing Emails

Customizing email templates

PreviousAdvanced email configurationNextCanned Responses (default messages)

Last updated 2 months ago

Was this helpful?

Email templates define the content and layout of the emails that are sent using , as or as , all of which you can configure with your custom templates. To manage templates, do the following:

1. Go to Templates under the EMAIL CONTENT menu item of the Outgoing Mails configuration tab.

2. Click on Add to create a new template or click on the three dots and choose Edit to modify an already existing template.

Templates may contain static and dynamic content related to issues, projects and users, such as:

  • Issue fields

  • Custom fields

  • Comments

  • Worklog details

It is possible to build templates from scratch, and there are predefined template themes that help to get started with custom templates.

Themes

Themes help you to build your own templates for various goals. Click the Add button to add new templates from themes.

Theme

Description

All Details

This theme is used for adding templates that render all issue fields, including custom fields.

Issue Commented

This theme is useful for notifications on events that contain comments, e.g. when an issue is commented, or a transition is executed.

Issue Updated

This theme focuses on highlighting changes made to an issue.

Work Logged

This theme gathers worklog information. It is useful for notifications on worklog-related events.

Empty

An empty theme for starting a template from scratch.

Building email templates

Email Templates may be built using using Apache Velocity Markup. Aspects to consider:

  • Basic Settings

  • HTML Template

  • Text Template

Setting up Basic Settings

Setting up the Subject Template

Subject templates are part of an Email template. They are used for generating the final subject of the emails sent using this template. The Subject template can contain static text and dynamic content, such as issue fields and custom fields.

Setting up the HTML Template

HTML Template is used when an HTML email is sent using this email template. The HTML body may be combined with HTML and Apache Velocity Markup to give templates a customizable look and layout.

The HTML template may be developed using a WYSIWYG editor. With this editor everyone can develop templates without HTML coding experience.

The Rich Text editor allows users to apply formatting, add tables, images, links, preview the template and edit content in full screen.

HTML can include issue fields and custom fields, and complex structures such as:

  • Comments

  • Issue link information

  • Change history

To edit HTML directly, open the HTML Editor and make changes to the source code of the template.

Embedding images

Email This Issue can embed an image targeted by a URL on an <img> tag level. This way you can send out attachments of the issue, and the recipient does not need to connect and create a Jira user account to see the attachment.

To allow this feature, add the data-embed="true" attribute to the <img> element.

Example:

<img src="https://www.meta-inf.hu/download/attachments/35749899/icon_product_jeti.png?version=1&modificationDate=1524212907169&api=v2" data-embed="true">

Setting up the Text Template

The Text Template is used for sending pure text emails with this email template.

The Text Body part can also contain issue fields, custom fields and the same set of complex structures as the HTML Body.

Using the Field Picker

Field Picker is a dropdown list of all issue fields and custom fields. When a field is selected, a tiny popup dialog opens with the template code fragment needed to render the value of the field in the email. Click the button in the dialog to add the code to the cursor position.

The Field Picker is available for Subject Template, HTML and Text Body templates.

Velocity Context for Templates

The following is a list of variables that are available in the email templates.

Variable

Definition

Example

Type

currentUser

The current user sending the email

$!currentUser.displayName

Renders the full name of the current user.

mailSubject

The email subject entered manually in the subject field on the manual email screen, notifications or workflow post functions. In case of a Send auto reply action this will represent the subject of the original email.

String

mailBody

The email body entered manually in the Body field in the manual email screen, notifications or workflow post functions.

Add this variable to all templates to render an email body entered by users. In case of a Send auto reply action this will represent the body of the original email.

String

issue

The Issue object with all available fields. The email is being sent in relation to this issue.

$!issue.summary

Renders the issue summary in the template.

baseUrl

The base URL of the Jira Cloud site. Useful to add links to Jira screens or operations.

It is a simple String value you can use in building links.

String

issueEvent

The issue event if the email is being sent as an event notification.

comment

The comment the user enters during the operation. E.g. when editing the issue or executing a workflow transition.

#renderComment()

Renders the comment.

changeLog

The changelog holding information about all fields changed during the operation. Old and new values are available.

#renderChanges()

Renders the changelog in a readable structure.

worklog

The worklog object holding details of the worklog entered or edited.

#renderWorklog()

Renders the worklog details.

emailCommand

The email definition object holding all recipients, the subject and body, the issue event and the comment details.

$!emailCommand.attachments

Returns the list of attachments being added to the email.

sentDate

A formatted date representing when the original email was processed by Email This Issue.

Available only in Reply/Reply all/Forward for an email.

$!sentDate

Prints the when the email was processed by Email This Issue.

String

stringUtils

String helper methods

$!stringUtils.isBlank($!issue.summary)

returns true if the issue summary is empty or null.

$!stringUtils.join($!issue.labels, ", ")

prints the labels separated by comma.

templateSupport

The support object useful in templates. A constantly enhanced object, that will receive more and more methods.

Velocity Macros

The following is the list of macros that are available in the email templates.

As a consequence, exisiting macros utilizing the 'Epic Link' value (usually in a form of #renderCustomField($!issue 'customfield_10014' - however, the custom field ID can vary per site) won't work after this deadline.

Please, review and consider replacing your old macros with any of our new offerings (#renderParent or #renderParentEpic).

Macro signature

Parameters

Description

Example

#renderDateTime($dateTimeValue $pattern $timezone)

  • $dateTimeValue: the value to be formatted

Formats a dateTime field based on the pattern and the timezone.

#renderDateTime($!issue.created "dd MMM yyyy hh:mm a" "Australia/West")

#renderIssueComments($order $num $restrictions)

  • $order: "asc" or "desc"

  • $num: an positive integer number or "all" to render all comments matching <restrictions>

  • $restrictions: comment restrictions, values are:

    • empty: render all comments regardless of the restrictions

    • "none": render comments which are not limited to groups, roles or which are not internal in Service Management

    • "public": render Service Management public comments

    • "internal": render Service Management internal comments

A generic, multi-purpose comment rendering macro.

#renderIssueComments("desc" "all" "") prints all comments starting with the latest one.

#renderIssueComments("asc" "all" "")prints all comments starting with the first one.

#renderIssueComments("desc" "1" "") prints the latest comment.

#renderIssueComments("desc" "all" "none") prints all comments which are not restricted.

#renderIssueComments("desc" "all" "public") prints all public comments starting with the latest one.

#renderLinkToPortal($linkText)

  • $linkText: text to show for the link in html mails.

    • Default value: "View portal"

    • In case of a text email this parameter is ignored, and the full URL is generated.

Renders a link to the portal with a custom text.

#renderLinkToPortal("View Customer Portal")

#renderLinkToPortalRequest($linkText)

  • $linkText: text to show for the link in html mails

    • Default value: "View request"

    • In case of a text email this parameter is ignored, and the full URL is generated.

Renders a link to the request with a custom text.

#renderLinkToPortalRequest("Open request")

#renderAllComments($comments)

  • $comments: The comments to render

Renders all comments (both public and internal).

#renderAllComments($!issue.comments)

#renderChanges()

Renders the changelog in a readable structure.

#renderChanges()

#renderComments($comments)

  • $comments: The comments to render

Renders the public comments.

#renderComments($!issue.comments)

#renderCommentsInReverseOrder($comments)

  • $comments: The comments to render

Renders the public comments in reverse order.

#renderCommentsInReverseOrder($!issue.comments)

#renderCustomField($issue $customFieldKey)

  • $issue: the issue in the context

  • $customFieldKey

    • key of the custom field(eg. customfield_10001)

Renders the value of the custom field as displayed in Jira.

#renderCustomField($!issue, 'customfield_10603')

#renderLastComment($issue)

  • $issue: The issue

Renders the last comment of the issue.

#renderLastComment($!issue)

#renderParent($issue, hierarchyLevel)

  • $issue: The issue, whose parent issue shall be rendered

  • $hierarchyLevel: the minimal hierarchy level of the parent issue to be rendered

Renders the parent issue of the issue passed as parameter, only if the hierarchy level of the parent issue is higher than or equal to the specified hierarchy level.

Hierarchy levels of some known issue types:

  • sub-task: -1

  • task/story: 0

  • epic: 1

  1. #renderParent($!issue, 0) => renders Story/Task or higher level (e.g. Epic) parent issue

  2. #renderParent($!issue, 1) => renders Epic or higher level (e.g. Initiative) parent issue

#renderParentEpic($issue)

$issue: The issue, whose parent issue shall be rendered

Renders the parent issue of the issue passed as parameter, only if the parent issue is an Epic.

In this regard, it can be considered as a replacement for the former 'Epic Link' custom field renderer.

#renderParentEpic($!issue)

Assets related macros

Please note that the following macros display Assets Objects with all (including hidden) of their attributes.

Macro signature
Parameters
Description
Example

#renderAssetsCustomField($issue $customFieldKey)

  • $issue: the issue in the context

  • $customFieldKey

    • key of the custom field(eg. customfield_10001)

    • The type of the field must be Assets Object

Renders all assets objects in the field with their labels and all of their attributes. Please note that all attributes (not visible, hidden, etc.) will be included in the email.

#renderAssetsCustomField($!issue, 'customfield_10093')

#renderAssets($aql $attributes $limit)

  • $attributes: Optional the attributes to display (used the same way as in the #renderAssetsCustomField macro).

  • $limit: Optional the maximum number of Assets Objects to display. Default: 10 Maximum: 100

Renders the labels and attributes of Assets Objects returned by the given AQL query.

Render assets with the default limit and all attributes: #renderAssets('objectId IN (1, 2, 3)') Render assets with custom limit and all attributes: #renderAssets('objectId IN (1, 2, 3)', $null, 25)

#renderAssetsLabel($aql $limit)

  • $limit: Optional the maximum number of Assets object to display. Default: 10 Maximum: 100

Renders the labels of Assets Objects returned by the given AQL query.

#renderAssetsLabel('objectId IN (1, 2, 3)', 5)

It is possible to render only the object names from an Assets field by using the #renderCustomField($issue $customFieldKey) macro.

Concatenating text to URLs

It is possible to add certain text to a URL link in a template. Open the template in its raw HTML editor form and use the following code:

#set($url = $issue.getCustomFieldValue('customfield_12345').value) <a href="$url/go" target="_blank">$url/go</a>

Make sure to use the correct customfield ID as shown in the following example:

Template operations

Templates offer a handful of operations under the three dots.

Template operation

Definition

Test

Opens the Test Template dialog.

Copy

Opens the template editor screen with a copy of the current template.

Edit

Opens the template editor.

Delete

Deletes the template from the system

Testing templates

While developing a template it is necessary to validate the look, layout and content the template renders. For the HTML Body you can use the rich text editor's Preview function to check the layout and content, but the best way to validate whether a template is correct is using the Test operation. It allows you to enter an issue key and send yourself an HTML or Text formatted email.

Once the email was sent, verify in your email app whether the content and layout was according your expectations.

Category: Emails are grouped into categories. Enter any text, and a category will be automatically created if doesn't already exist. There are special categories for special uses, for instance the responses. By default, templates in this category can be selected as a canned response on the .

The $!mailSubject variable is replaced by the subject you enter in the or .

When you send a manual email, the Subject Template is used for generating the subject in the . The subject you enter in the email screen is not modified further by the email templates when the email is sent.

According to , the 'Epic Link' custom field will be deprecated as of 31th May 2022.

Due to some known limitations in hierarchy level retrieval for custom issue types introduced in Advanced Roadmaps (verified by Atlassian in ), the #renderParent macro currently does not work as expected for higher hierarhy levels than that of Epic (1). E.g. #renderParent($!issue, 2) will not render a parent having 'Initiative' issue type (hierarchy level 2).

$pattern: the pattern describing the date and time format. You can find description about formatting and patterns .

$timezone: the time zone used for formatting. You can find a list of in the Appendix.

$aql: search query in

$aql: search query in

📤
Email Notification Schemes
Workflow Post Function
The Email Button and the Email Screen
Atlassian's announcement
this community announcement
User
Issue
IssueEvent
Comment
Changelog
Worklog
EmailCommand
org.apache.commons.lang3.StringUtils
TemplateSupport
here
Supported Time Zones
Assets Query Language
Assets Query Language
The Email Button and the Email Screen
Email Notification Schemes
Workflow Post Function
Email Screen
Templates
Add new Template
Basic Settings
Subject Template
HTML Template
Raw HTML Editor
Text Template
Field Picker
Test Template