Customizing email notification content

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

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!

1 vote

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.

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).

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

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.

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.

Thanks for all the answers, 

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

Thank you.

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.

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?

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!

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.

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)

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")

The 2nd to 6th lines

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

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 )

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 :)

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

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")

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

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.

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")

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!

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?

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?

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

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

650 views 6 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you