Customizing email notification content

Elif Alverson December 28, 2015

Hello, 

I would like to customize the email notification content that are being received. How can I stop seeing the " comments" field on the email notifications? 

Thanks!

5 answers

1 vote
GabrielleJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2015

Agree with Jobin. You need to hack the VM files of JIRA to change the contents OR an add-on that can send emails based on what you need. I have used the JIRA ScriptRunner "Send Custom Email" for this scenario and it works pretty well situationally (since it can only be added as a post-function).

1 vote
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2015

You will have to modify the notification velocity templates in the code. The only other option would be use a plugin and setup your own notifications.

1 vote
Elif Alverson December 28, 2015

Chander, 

We would like to change the " content " of the Notification emails when there is an update of the JIRA Issue. We would like to see only the " issue type, Assignee, Created, Priority, Reporter and the status changes" not the comments for security purposes. I still would like to get the email updates without the comments. 

Thanks!

0 votes
Elif Alverson December 29, 2015

Thanks for all the answers, 

What if i want to make the changes in the directories? Anyone worked on the html/includes ? 

Thank you.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2015

Yes, you can make changes in the templates under /templates/email/html as appropriate. You will have to restart JIRA to make the changes effective.

Elif Alverson December 29, 2015

Can you please tell me what is the exact path name that I can make changes that will not shown the comments on the emails?

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2015

You will find multiple files under JIRA_INSTALL/atlassian-jira/WEB-INF/classes/templates/email/html folder, one for each event. Modify the files for the events you are interested in!

Elif Alverson December 29, 2015

Can you please provide me with an example of what changes would need to be made in the particular file within one of those directories, i.e. "Remove xxxx variable string in the if then statements of top_comment.vm". Thanks in advance for any guidance you are able to provide.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 30, 2015

The code in the .vm files is pretty simple to read and amend, especially if you're just for removing comments - the code is not far off "#if (comments exist) show comments #end". Open them up and have a look, it's quite easy to read, as the templates are not complex (compared with the reporting ones, or things that have been rewritten in soy)

Elif Alverson January 4, 2016

Nic, Here is what I have under the “ issuecommented.vm”. What should I comment out not to see any comments in here? I am not familiar with this type of settings. Thanks much! #defaultMailHeader("email.event.activity.commented.issue", $changelogauthorLink) #set ($issueTitleBody="#parse('templates/email/html/includes/patterns/comment-title.vm')") #rowWrapperNormal($issueTitleBody) #parse('templates/email/html/includes/patterns/comment-top.vm') #set ($commentActionBody="#parse('templates/email/html/includes/patterns/comment-action.vm')") #rowWrapperNormal($commentActionBody) ###set($extraFooterContent = "#parse('templates/email/html/includes/set-issue-details-context.vm')") #parse("templates/email/html/includes/footer.vm")

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 4, 2016

The 2nd to 6th lines

Elif Alverson January 4, 2016

If I comment them out, would it be enough? If not, what changes should I make?

Elif Alverson January 4, 2016

Commented out did not help, here is what I got; Comment I put was test B.... set ($issueTitleBody=" Re: December 28, Notification Email Test ") $issueTitleBody test B rowWrapperNormal( Add Comment )

Elif Alverson January 4, 2016

Nic, I have replaced the " comment -title.vm (second line above : #set ($issueTitleBody="#parse('templates/email/html/includes/patterns/comment-title.vm')")) to an unknown file and I get the email saying " Could not locate resource ". What should I replace comment-title.vm file with that will not give me any error message ? I will keep asking questions :)

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 4, 2016

That line is trying to parse (include) another .vm. If you give it a non-existent file, it's going to fail. My suggestion was that you comment or remove that line, so I'm not sure what you're doing there. The previous comment also seems to have some output that implies you have not removed/commented all of the lines I suggested

Elif Alverson January 4, 2016

Nic, I deleted all the lines except the ones below. AND IT WORKS!!!! You are AWESOME. #disable_html_escaping() #defaultMailHeader("email.event.activity.commented.issue", $changelogauthorLink) ###set($extraFooterContent = "#parse('templates/email/html/includes/set-issue-details-context.vm')") #parse("templates/email/html/includes/footer.vm")

Elif Alverson January 4, 2016

Nic, I will probably keep bothering you since I have listed ones to remove files from ; Thanks so much! issueclosed.vm issuedeleted.vm issuenotify.vm issueworklogdeleted.vm issueworkstopped.vm issuecommentedited.vm issuegenericevent.vm issuereopened.vm issueworklogged.vm issuementioned.vm issueresolved.vm issueworklogupdated.vm issueassigned.vm issuecreated.vm issuemoved.vm issueupdated.vm issueworkstarted.vm

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 4, 2016

Yay! Glad it worked in the end! I do find trying to comment velocity a bit of a pain sometimes - sticking the ## on the front does work, but I forget that it makes it harder to follow properly.

Elif Alverson January 4, 2016

Nic, trying to edit the issuementioned.vm, tried everything however the person mentioned in the JIRA Issue still sees the comments, not the reporter or the issue assignee but whomever mentioned in the comment field. Any idea? #disable_html_escaping() #defaultMailHeader("jira.email.title.mention", $changelogauthorLink) #set ($issueTitleBody="#parse('templates/email/html/includes/patterns/comment-title.vm')") #rowWrapperNormal($issueTitleBody) #parse('templates/email/html/includes/patterns/comment-top.vm') #set ($commentActionBody="#parse('templates/email/html/includes/patterns/comment-action.vm')") #rowWrapperNormal($commentActionBody) ###set($extraFooterContent = "#parse('templates/email/html/includes/set-issue-details-context.vm')") #parse("templates/email/html/includes/footer.vm")

Elif Alverson January 5, 2016

Hello, Only one file left to be edited which is issuecommented.vm. I have tried everything even deleting all the lines from it , but the mentioned person still can see the comments when he is mentioned on the comment section. Any help will be appreciated greatly. HELP!

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 5, 2016

You don't seem to have removed anything from that file. But assuming I'm misunderstanding and you have edited something... Have you done both files? HTML and Text? And restarted JIRA?

Elif Alverson January 5, 2016

OMG, you are back!!!! I have removed everything from issuementioned.vm which is under the root@is-k-jira-sb html directory. It did not help. What directory text files are in?

Elif Alverson January 6, 2016

Nic, Figured it out! Thanks so much! You are my JIRA Hero!

0 votes
Elif Alverson December 28, 2015

What plugin unit can help me with this kind of customization?

Chris Whitten [Comskil] December 28, 2015

look at "JIRA Email this Issue" plugin as it has its own templates or there is other that lets you modify the velocity templates but we like that plugin for what we use it for.

Andy Brook
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2015
Vladimir Horev _Raley_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 25, 2016

Check out 

https://marketplace.atlassian.com/plugins/net.vacom.jirassimo/server/overview
You'll have full control over the content of the notification message and can fine-tune it to avoid irrelevant messages.

Suggest an answer

Log in or Sign up to answer