Project

General

Profile

Filtering details in notification emails.

Added by Mike Ferrari over 7 years ago

Thought i would share....

I needed to strip out most of the ticket details in the notification emails that are sent from redmine. In this particular case the ticket data was sensitive information that shouldn't be in email. I saw there was a plugin for 1.x and 2.x versions but nothing for 3.x. I dont quite have the ruby skills or understanding of how redmine internals work to write a plugin yet. I hope this information will help those who need to do what i did. It's sort of a hack, and has to be redone after every upgrade. I just store the edited files and diff and sftp them after an upgrade.

If you look at the files in ~/redmine/app/views/mailer

_issue.html.erb and are the default template files that make up the main body in the notification emails. Pretty much everything wrapped in horizontal rules including the "link title" in the html version. issue_edit.html.erb is the template used for the details above the horizontal rule and "link title" for addition and modification of ticket items.

edit _issue.html.erb to wrap everything starting after the first line (just above the "render_email_issue_attributes" line) to after the last line with an "if false" statement.

<% if false %>
   ...
<% end %>

Also edit the issue_edit.html.erb file with an "if false" statement to filter out details of the update. From right above the <ul> tag down to just before the </hr>.

This can be done to both the html and text and "add" templates.. although in slightly different places (you can fine tune it as needed).

also, the text templates need a "-%>"

<% if false -%>
   ...
<% end -%>

Be sure to restart redmine (on centos 7 i usually "systemctl restart httpd") for the changes to take effect.