some email notification header fixes

some email notification header fixes

diff --git a/lib/email/sender.rb b/lib/email/sender.rb
index 48b3228..2bfbae9 100644
--- a/lib/email/sender.rb
+++ b/lib/email/sender.rb
@@ -58,8 +58,6 @@ module Email
 
       host = Email::Sender.host_for(Discourse.base_url)
 
-      @message.header['List-Id'] = Email::Sender.list_id_for(SiteSetting.title, host)
-
       topic_id = header_value('X-Discourse-Topic-Id')
       post_id = header_value('X-Discourse-Post-Id')
       reply_key = header_value('X-Discourse-Reply-Key')
@@ -67,9 +65,16 @@ module Email
       if topic_id.present?
         email_log.topic_id = topic_id
 
-        topic_identitfier = "<topic/#{topic_id}@#{host}>"
-        @message.header['In-Reply-To'] = topic_identitfier
-        @message.header['References'] = topic_identitfier
+        topic_identifier = "<topic/#{topic_id}@#{host}>"
+        @message.header['In-Reply-To'] = topic_identifier
+        @message.header['References'] = topic_identifier
+
+        # http://www.ietf.org/rfc/rfc2919.txt
+        @message.header['List-ID'] = "<topic.#{topic_id}.#{host}>"
+        # can't figure out how to get the current URL of the topic here
+        #@message.header['List-Archive'] =
+        # in github notifications, these fields are identical
+        @message.header['List-Post'] = @message.header['Reply-To']
       end
 
       email_log.post_id = post_id if post_id.present?
@@ -110,12 +115,6 @@ module Email
       host
     end
 
-    def self.list_id_for(site_name, host)
-      "\"#{site_name.gsub(/\"/, "'")}\" <discourse.forum.#{Slug.for(site_name)}.#{host}>"
-    end
-
-
-
     private
 
     def header_value(name)
diff --git a/spec/components/email/sender_spec.rb b/spec/components/email/sender_spec.rb
index c13342b..8c4a8e3 100644
--- a/spec/components/email/sender_spec.rb
+++ b/spec/components/email/sender_spec.rb
@@ -39,20 +39,6 @@ describe Email::Sender do
 
   end
 
-  context "list_id_for" do
-    it "joins the host and forum name" do
-      Email::Sender.list_id_for("myforum", "mysite.com").should == '"myforum" <discourse.forum.myforum.mysite.com>'
-    end
-
-    it "removes double quotes from names" do
-      Email::Sender.list_id_for('Quoted "Forum"', 'quoted.com').should == '"Quoted \'Forum\'" <discourse.forum.quoted-forum.quoted.com>'
-    end
-
-    it "converts the site name to lower case and removes spaces" do
-      Email::Sender.list_id_for("Robin's cool Forum!", "robin.com").should == '"Robin\'s cool Forum!" <discourse.forum.robins-cool-forum.robin.com>'
-    end
-  end
-
   context 'with a valid message' do
 
     let(:reply_key) { "abcd" * 8 }

GitHub sha: beaa1455729c8a442e37e9f23d908fa7677ce0cb

This commit has been mentioned on Discourse Meta. There might be relevant details there: