Patch #13359

Better List-Id to help aid Gmail filtering

Added by Jimmy Engelbrecht over 4 years ago. Updated over 4 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email notifications
Target version:-

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>

Related issues

Related to Redmine - Feature #10888: Bring back List-Id to help aid Gmail filtering Closed
Related to Redmine - Defect #14792: Don't add angle brackets in List-Id / mailer.rb New

History

#1 Updated by Jimmy Engelbrecht over 4 years ago

Improvement to #10888

#2 Updated by Mattias Amnefelt over 4 years ago

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

#3 Updated by Etienne Massip over 4 years ago

  • Category set to Email notifications

#4 Updated by Toshi MARUYAMA about 4 years ago

  • Related to Defect #14792: Don't add angle brackets in List-Id / mailer.rb added

Also available in: Atom PDF