Jira notification emails contain HTML tags

Notification format

JEditor is a powerful rich text editor with HTML under the hood. When you edit a JEditor-rendered field the editor generates HTML code and submits this code to Jira. To keep the formatting intact the data are stored in the HTML format.

Configure your Jira to use the HTML format as the default format for emails to receive HTML notifications. If all your notifications come with visible HTML tags then your default email format is plain text.

JIRA Administrators can specify the default email format under Administration > User Management > User Preferences.

Why do I still see HTML tags in Jira notifications after I switched to the HTML format?

Some notifications (e.g. Issue Updated and Comment Updated) will keep coming with visible HTML tags. Jira uses a diff renderer to highlight changes made by a user with green and red background. This diff renderer cannot display changes in an HTML document and forces the plain text format. There’s a workaround to get rid of HTML tags in these emails:

  1. Download changelog.vm and replace the original changelog.vm under <Jira-install-directory>\atlassian-jira\WEB-INF\classes\templates\email\html\includes\fields\
  2. Download changelog-issue-description.vm and replace the original changelog-issue-description.vm under <Jira-install-directory>\atlassian-jira\WEB-INF\classes\templates\email\html\includes
  3. Download set-issue-details-context.vm and replace the original set-issue-details-context.vm under <Jira-install-directory>\atlassian-jira\WEB-INF\classes\templates\email\html\includes
  4. Download issuecommentedited.vm and replace the original issuecommentedited.vm under <Jira-install-directory>\atlassian-jira\WEB-INF\classes\templates\email\html\
  5. Download worklog-top.vm and replace the original worklog-top.vm under <Jira-install-directory>\atlassian-jira\WEB-INF\classes\templates\email\html\includes\patterns
  6. Download worklogchanges.vm and replace the original worklogchanges.vm under <Jira-install-directory>\atlassian-jira\WEB-INF\classes\templates\email\html\includes\fields
  7. Restart Jira to reload templates

Make sure that Jira has read access to these new files.

Batching Email Notifications

If you have the Batching Email Notifications feature enabled in your Jira instance then making changes to Jira email templates will not affect the batched email notifications.

To get rid of HTML tags in batched email notifications you need to edit the velocity templates of the Jira inform - batchers app:

  1. Find out the Jira inform - batchers app version
    1. Go to Jira administration > Manage apps > Manage apps
    2. From the drop-down, select All apps, and search for Jira inform - batchers
    3. Expand the app, and check the installed version
      Your Jira installation directory might have multiple versions of this app. It is important to know which one to modify.
  2. Copy the app from the Jira installation directory
    1. Go to <jira-installation-directory>/atlassian-jira/WEB-INF/atlassian-bundled-plugins/
    2. Find the batchers-<version>.jar file
    3. Copy the file to a separate directory
      You should never edit the .jar files inside the Jira installation directory. It’s also good to keep the original JAR file in case you needed to revert the changes.
  3. Extract the template files from the app’s JAR file
    1. Extract the files using the following command (this example is for Batchers v1.3.2 from Jira 8.4.1):
      jar xf batchers-1.3.2.jar templates/email
      Note that you’ll need JDK installed for it to work.
  4. Edit IssueUpdateBatcher-content.vm making the following changes:
    1. Replace all instances of $update.diff​ with $update.text
    2. Replace all instances of $comment.diff with $comment.text
    3. Save the file
  5. Insert the modified template back into the JAR file
    1. Use the following command to re-pack the app (example for version 1.1.10):
      jar uf batchers-1.3.2.jar templates/email
      Note that you’ll need JDK installed for it to work.
  6. Upload the app to Jira
    1. Go to Jira administration > Manage apps > Manage apps
    2. Click the Upload app link, and upload the modified JAR file. The changes will be visible once the app is reinstalled, and you don’t have to restart your Jira instance

Please note: the Jira inform - batchers app, and the templates inside it will get overwritten after every upgrade of your Jira instance. This means that you have to reapply the changes after an upgrade.

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk