メールコンテンツのカスタマイズ

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

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.

考慮事項

  • If you're looking to change the columns in your filter subscriptions, you don't need to customize the mail templates.

  • There's a feature request to improve this at JRA-7266, which you can vote on to improve its chances of being implemented.

  • Any changes to Velocity templates (as well as JSPs) will be overwritten following a Jira upgrade. In such a case, you will need to manually copy your modified files to the new Jira version. If the Velocity templates and/or JSPs have changed in the newer version, you will have to manually port your customizations into them (as opposed to copying these files directly over from your old Jira installation to your upgraded one).

    Velocity テンプレートやその他の Jira ファイルのカスタマイズは、アトラシアン サポートの範囲には含まれません。

電子メールテンプレートの場所

  1. Go to the following location in your Jira installation directory: 

    /atlassian-jira/WEB-INF/classes/templates/email/

    If you're using Jira sources files, go to jira/src/etc/java/templates/email/ instead .

  2. Under this directory, there are three subdirectories:

    • html - contains the templates used to create emails in html
    • text - contains the templates used to create plain text mail outs
    • subject - contains the templates used to generate the subject of the emails


  3. Bring the template up in your favorite text editor. Refer to the the Jira template documentationand Velocity Users Guide to make the customizations you want.

  4. Jira を再起動します。

New email templates

  1. Create your new mytemplate.vm files in the htmltext and subject directories, based on the existing files in those directories

  2. Add the templates to atlassian-jira/WEB-INF/classes/email-template-id-mappings.xml to make them valid choices for when you are adding a new event.

高度なカスタマイズ

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.

Jira を再起動せずに Velocity テンプレートをデプロイする

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:

  1. Change class.resource.loader.cache from true to false
  2. #velocimacro.library.autoreload=true からコメント記号 (#) を削除します。

本番環境でこの変更を行うと、Jira では最終的にページを提供することができなくなり、ログ ファイルに "ran out of parsers" エラーが表示されます。

See also Adding Custom Fields to Email.

最終更新日: 2019 年 2 月 11 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.