Changing the email template
Added by Tory Wolf over 11 years ago
Hello,
I'm trying to customize the template of the email notification.
I'd like the message to include the text of the issue and exclude "category" and "version" fields from the body of the message. But I cant find the file where I can change it. I found how I can change the subject of the mail, header and footer. But not body.
Could anyone help me with this?
Replies (13)
RE: Changing the email template - Added by Kuniharu AKAHANE over 11 years ago
Hi, Tory
This is my patch for Redmine 2.2.4-stable.
I did not test it well, but hope this help.
+ : add the line - : delete the line
diff -r 9408ffaa08a2 app/views/mailer/_issue.html.erb
--- a/app/views/mailer/_issue.html.erb Wed Jan 09 16:20:58 2013 +0000
+++ b/app/views/mailer/_issue.html.erb Wed Feb 27 17:13:13 2013 +0900
@@ -7,6 +7,9 @@
<li><%=l(:field_assigned_to)%>: <%=h issue.assigned_to %></li>
-<li><%=l(:field_category)%>: <%=h issue.category %></li>
-<li><%=l(:field_fixed_version)%>: <%=h issue.fixed_version %></li>
<li><%=l(:field_start_date)%>: <%=h issue.start_date %></li>
<li><%=l(:field_due_date)%>: <%=h issue.due_date %></li>
<% issue.custom_field_values.each do |c| %>
<li><%=h c.custom_field.name %>: <%=h show_value(c) %></li>
<% end %>
+<li><%=l(:field_description)%>: <%=h issue.description %></li>
diff -r 9408ffaa08a2 app/views/mailer/_issue.text.erb
--- a/app/views/mailer/_issue.text.erb Wed Jan 09 16:20:58 2013 +0000
+++ b/app/views/mailer/_issue.text.erb Wed Feb 27 17:13:13 2013 +0900
@@ -7,6 +7,8 @@
* <%=l(:field_assigned_to)%>: <%= issue.assigned_to %>
-* <%=l(:field_category)%>: <%= issue.category %>
-* <%=l(:field_fixed_version)%>: <%= issue.fixed_version %>
* <%=l(:field_start_date)%>: <%=h issue.start_date %>
* <%=l(:field_due_date)%>: <%=h issue.due_date %>
<% issue.custom_field_values.each do |c| %>* <%= c.custom_field.name %>: <%= show_value(c) %>
<% end -%>
+* <%=l(:field_description)%>: <%=h issue.description %>
RE: Changing the email template - Added by Tory Wolf over 11 years ago
Hi, Kuniharu
Thank you very much for help, it works!
I use version 1.0.4.
If someone needs, files are called _issue_text_html.rhtml and _issue_text_plain.rhtml, but content is the same.
RE: Changing the email template - Added by Gabor Balazs over 10 years ago
Hello,
How can I control if just want to add one ot two custom field? Not all of them. If my custom field's id is 93, how should look the code (<% issue.custom_field_values.each do |c| >* <= c.custom_field.name >: <= show_value(c) >
< end -%>)?
Thanks!
RE: Changing the email template - Added by Igor Panassiouk over 9 years ago
I'd like to make same modification.
But in Redmine 2.6.6 there is no "<%=l(:field_fixed_version)%>:" statements in app/views/mailer/_issue.text.erb
Any advice?
RE: Changing the email template - Added by Kuniharu AKAHANE over 9 years ago
Hi, Igor
This is my patch for Redmine 2.6.6.stable.
I did not test it well, but hope this help.
- app/helpers/issues_helper.rb
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index ab78fe0..44aee8f 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -234,7 +234,7 @@ module IssuesHelper def email_issue_attributes(issue, user) items = [] - %w(author status priority assigned_to category fixed_version).each do |attribute| + %w(author status priority assigned_to ).each do |attribute| unless issue.disabled_core_fields.include?(attribute+"_id") items << "#{l("field_#{attribute}")}: #{issue.send attribute}" end
RE: Changing the email template - Added by Anonymous almost 6 years ago
Hi, what would I need to edit to remove the description on an HTML RM update issue and new issue:
RM 3.3.3.stable
Sometimes we post sensitive information, and I don't want it sent through email in clear.
The rest of the info for issues that are updated or new are fine.
Thanks!
RE: Changing the email template - Added by Go MAEDA almost 6 years ago
Andrew X wrote:
Hi, what would I need to edit to remove the description on an HTML RM update issue and new issue:
The following change should suppress the issue description in email notifications.
Index: app/views/mailer/_issue.html.erb
===================================================================
--- app/views/mailer/_issue.html.erb (revision 17835)
+++ app/views/mailer/_issue.html.erb (working copy)
@@ -2,8 +2,6 @@
<%= render_email_issue_attributes(issue, user, true) %>
-<%= textilizable(issue, :description, :only_path => false) %>
-
<% if issue.attachments.any? %>
<fieldset class="attachments"><legend><%= l(:label_attachment_plural) %></legend>
<% issue.attachments.each do |attachment| %>
Index: app/views/mailer/_issue.text.erb
===================================================================
--- app/views/mailer/_issue.text.erb (revision 17835)
+++ app/views/mailer/_issue.text.erb (working copy)
@@ -3,7 +3,6 @@
<%= render_email_issue_attributes(issue, user) %>
----------------------------------------
-<%= issue.description %>
<% if issue.attachments.any? -%>
---<%= l(:label_attachment_plural).ljust(37, '-') %>
RE: Changing the email template - Added by Anonymous almost 6 years ago
@ Go MAEDA
This worked - thanks! It certainly will be helpful to others!
~ A.I
RE: Changing the email template - Added by Pasi Oja-Nisula almost 6 years ago
Hi,
Thank you! I was just researching this and this seems to work. I tried to do the same thing to issue_edit.[html|text].erb and got also rid of text in issue updates.
Since there are many situations nowadays where some personal data cannot be sent via email, but link to web site is ok, shouldn't this be a standard feature in Redmine? I guess there should be separate setting for removing issue description and notes from updates.
I'm actually surprised if this isn't already a feature, but I didn't find anything while scanning the changelogs for 4.0 series. The closest thing I could find was this request, which is already 7 years old. Maybe I'll add some comments there.
http://www.redmine.org/issues/10459
The same thing could be accomplished by providing template to edit the notification email body. Then administrator could just leave out some fields and just provide the link to issue. Following this thought, these issues could partly solve the problem:
http://www.redmine.org/issues/16209
http://www.redmine.org/issues/15615
http://www.redmine.org/issues/6221
Pasi
RE: Changing the email template - Added by Taine Woo over 5 years ago
I think it would be good if there is some options to enable/disable each parts of issues, including fields, descriptions and also full journal history, to be or not to be shown in notification email.
for me, i would like to include two parts in the notification email:
1. the modified parts, it's implemented in current redmine 4.
2. the detail info of this issue, and also full notes history of it (all info displayed on the website). first half of this point is implemented in current redmine 4, but later half, the full notes history, is not displayed in the mail in current redmine 4.
also includes this issue and post:
http://www.redmine.org/issues/2026
http://www.redmine.org/boards/1/topics/13811?r=13844#message-13844
RE: Changing the email template - Added by Taine Woo over 5 years ago
better if there is option for admin to choose. and also option for each field to be set, for display in notification mail or not.
RE: Changing the email template - Added by Anonymous almost 5 years ago
Pasi Oja-Nisula wrote:
Hi,
I tried to do the same thing to issue_edit.[html|text].erb and got also rid of text in issue updates.
Can someone post exactly what to remove in issue_edit.[html|text].erb to remove the text in issue updates?
Thanks!
RE: Changing the email template - Added by Jonathan Cormier over 2 years ago
Created a plugin to override the mailer templates. Currently tested on redmine 4.2.3
https://github.com/jcormier/redmine_private_email