Feature #13359
closed
Add project identifier to List-Id header in notification emails for better Gmail filtering
Added by Jimmy Engelbrecht almost 12 years ago.
Updated about 2 months ago.
Category:
Email notifications
Description
This gives the possibility to filer mail-updates from different project into different folders.
--- ./redmine-2.1.6/app/models/mailer.rb 2013-01-09 17:34:07.000000000 +0100
+++ /opt/redmine-2.1.6/app/models/mailer.rb 2013-03-05 15:33:38.438398984 +0100
@@ -386,7 +386,7 @@
'X-Auto-Response-Suppress' => 'OOF',
'Auto-Submitted' => 'auto-generated',
'From' => Setting.mail_from,
- 'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
+ 'List-Id' => "<#{@issue.project.identifier}.#{Setting.host_name}>"
# Removes the author from the recipients and cc
# if he doesn't want to receive notifications about what he does
The resulting List-Id could look like this:
List-Id: <cantemo-ab.vvv.cantemo.com>
Files
Here is an updated patch which doesn't croak on mails which are sent for non-issue updates (user info notifications for example)
--- redmine-2.1.6/app/models/mailer.rb.orig 2013-01-09 17:34:07.000000000 +0100
+++ redmine-2.1.6/app/models/mailer.rb 2013-04-16 11:33:00.057745141 +0200
@@ -380,13 +380,19 @@
end
def mail(headers={})
+ if @issue
+ listid = "<#{@issue.project.identifier}.#{Setting.host_name}>"
+ else
+ listid = "#{Setting.host_name}>"
+ end
+
headers.merge! 'X-Mailer' => 'Redmine',
'X-Redmine-Host' => Setting.host_name,
'X-Redmine-Site' => Setting.app_title,
'X-Auto-Response-Suppress' => 'OOF',
'Auto-Submitted' => 'auto-generated',
'From' => Setting.mail_from,
- 'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
+ 'List-Id' => listid
# Removes the author from the recipients and cc
# if he doesn't want to receive notifications about what he does
- Category set to Email notifications
- Related to Defect #14792: Don't add a display name and extra angle brackets in List-Id header field added
- Has duplicate Feature #41031: Include project identifier in List-Id header field of notification emails added
I found this issue the day after I posted #41031. In #41031, I wrote as follows:
I propose adding the project identifier to the List-Id
header field of notification emails. Currently, the List-Id
is based on the emission email address (Setting.mail_from
). I want to change the List-Id to include both the project identifier and the emission email address.
The current notification email headers include the X-Redmine-Project
field, which contains the project identifier. However, widely used email services Gmail do not support filtering based on custom headers starting with X-
. This makes it difficult to create filters based on the project.
By including the project identifier in the List-Id
, users can utilize Gmail’s list
operator to create filters based on the project. This enhancement would improve the ability to organize and manage project-related emails in Gmail.
I also posted an experimental implementation in #41031#note-1.
Regarding my patch in #41031#note-1 that introduces the new setting Setting.include_project_in_list_id
to optionally exclude the project identifier from the List-Id field, now I believe this setting is unnecessary.
Users who filter all emails from a specific Redmine instance using the List-Id can achieve the same result by using the From field in their filters even if the List-Id value changes. Since there is an alternative method available, adding a new setting to keep the List-Id the same as the current value is redundant.
I have wrote a new patch.
The previously proposed patches include the project identifier in the List-Id only when an issue is created or updated. However, this new patch includes the project identifier in the List-Id for all notifications within the project, such as the creation and updating of wiki pages and posting messages to forums.
- Target version changed from Candidate for next major release to 6.0.0
Setting the target to 6.0.0.
- Subject changed from Better List-Id to help aid Gmail filtering to Add project identifier to List-Id header in notification emails for better Gmail filtering
- Status changed from New to Closed
- Assignee set to Go MAEDA
Committed the patch r22944.
The List-Id header field now includes a project identifier like:
List-Id: <ecookbook.redmine.example.net>
In this case, "ecookbook" is the project identifier.
- Tracker changed from Patch to Feature
Also available in: Atom
PDF