Defect #14792

Don't add a display name and extra angle brackets in List-Id header field

Added by Jan Niggemann (redmine.org team member) over 6 years ago. Updated 10 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Email notifications
Target version:4.1.0
Resolution:Fixed Affected version:

Description

Continued from here: http://www.redmine.org/boards/1/topics/39232

If Setting.mail_from already contains a (valid) address like "Ticket System <>", then it's wrong to insert angle brackets in this line http://www.redmine.org/projects/redmine/repository/revisions/11988/entry/trunk/app/models/mailer.rb#L389

It creates List-Ids of the form "<Ticket System <>>", which, if I understand correctly, are not RFC compliant: http://www.ietf.org/rfc/rfc2919.txt

See also #10888 and propsed patch #13359

fix-14792.diff Magnifier (1.22 KB) Go MAEDA, 2019-02-13 04:01


Related issues

Related to Redmine - Patch #13359: Better List-Id to help aid Gmail filtering New
Related to Redmine - Defect #30785: Mail handler does not ignore emails sent from emission em... Closed
Related to Redmine - Feature #5913: Authors name in from address of email notifications Closed 2010-07-20

Associated revisions

Revision 17873
Added by Go MAEDA 10 months ago

Test that List-Id header field does not include display name and extra angle brackets (#14792).

Patch by Go MAEDA.

History

#1 Updated by Toshi MARUYAMA over 6 years ago

  • Related to Patch #13359: Better List-Id to help aid Gmail filtering added

#2 Updated by Go MAEDA 10 months ago

  • Related to Defect #30785: Mail handler does not ignore emails sent from emission email address if Setting.mail_from includes display name added

#3 Updated by Go MAEDA 10 months ago

  • File fix-14792.diffMagnifier added
  • Priority changed from Low to Normal
  • Target version set to 4.0.2

You can fix this issue with the attached patch.

#4 Updated by Go MAEDA 10 months ago

The patch attached in #5913#note-17 also fixes this issue. It is unnecessary to merge fix-14792.diff if that patch is merged.

#5 Updated by Go MAEDA 10 months ago

  • Related to Feature #5913: Authors name in from address of email notifications added

#6 Updated by Go MAEDA 10 months ago

  • Assignee set to Go MAEDA
  • Target version changed from 4.0.2 to 4.1.0
  • Resolution set to Fixed

Fixed in r17870 along with #5913.

I will commit the following test later.

Index: test/unit/mailer_test.rb
===================================================================
--- test/unit/mailer_test.rb    (リビジョン 17870)
+++ test/unit/mailer_test.rb    (作業コピー)
@@ -213,6 +213,14 @@
     assert_equal issue.author.login, mail.header['X-Redmine-Sender'].to_s
   end

+  def test_email_headers_list_id_should_not_include_display_name
+    Setting.mail_from = 'Redmine <redmine@example.net>'
+    issue = Issue.find(1)
+    Mailer.deliver_issue_add(issue)
+    mail = last_email
+    assert_equal '<redmine.example.net>', mail.header['List-Id'].to_s
+  end
+
   def test_plain_text_mail
     Setting.plain_text_mail = 1
     journal = Journal.find(2)

#7 Updated by Go MAEDA 10 months ago

Adding a test method is too much. We can test that display name and other stuff is not included by adding only one line.

Index: test/unit/mailer_test.rb
===================================================================
--- test/unit/mailer_test.rb    (リビジョン 17872)
+++ test/unit/mailer_test.rb    (作業コピー)
@@ -198,11 +198,13 @@
   end

   def test_email_headers
+    Setting.mail_from = 'Redmine <redmine@example.net>'
     issue = Issue.find(1)
     Mailer.deliver_issue_add(issue)
     mail = last_email
     assert_equal 'All', mail.header['X-Auto-Response-Suppress'].to_s
     assert_equal 'auto-generated', mail.header['Auto-Submitted'].to_s
     assert_equal '<redmine.example.net>', mail.header['List-Id'].to_s
   end
</diff>

#8 Updated by Go MAEDA 10 months ago

  • Subject changed from Don't add angle brackets in List-Id / mailer.rb to Don't add a display name and extra angle brackets in List-Id header field
  • Status changed from New to Closed

Updated the test to catch this issue (r17873).

Also available in: Atom PDF