Documentation for JIRA 5.1.x. 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.
注意:
Customisations to Velocity templates or other JIRA files are not included in the scope of Atlassian Support.
The information on this page does not apply to JIRA OnDemand.
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
、および subject
の 3 つのディレクトリがあります。html
サブディレクトリには html 形式でメールを作成するために使用するテンプレートが含まれ、text
ディレクトリにはプレーン テキスト メール出力が含まれます。subject
ディレクトリにはメールの件名を生成するために使用されるテンプレートが含まれます。テンプレートには、メールをトリガーするイベントに関連する名前が設定されます。新しい電子メールテンプレートの場合:
html
、text
、および subject
ディレクトリで、それらのディレクトリ内の既存のファイルに基づき、新しく mytemplate.vm
ファイルを作成します。atlassian-jira/WEB-INF/classes/email-template-id-mappings.xml
に追加して、新しいイベントを追加する際に選択できるようにします。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
を true
から false
に変更します。#velocimacro.library.autoreload=true
からコメント記号 (#
) を削除します。
See also Adding Custom Fields to Email.