@@ -138,7 +138,7 @@ def get_recipients(self, comment):
138138
139139 return (torcpts , ccrcpts )
140140
141- def _get_name (self , comment ):
141+ def _get_author_name (self , comment ):
142142 """
143143 Get the real name of the user who made the comment. If it cannot be
144144 determined, return their username.
@@ -150,6 +150,7 @@ def _get_name(self, comment):
150150 return comment .author
151151
152152 def notify (self , comment ):
153+ self .comment_author = self ._get_author_name (comment )
153154
154155 self .data .update ({
155156 "comment" : comment ,
@@ -158,18 +159,11 @@ def notify(self, comment):
158159 projname = self .config .get ("project" , "name" )
159160 subject = "Re: [%s] %s" % (projname , comment .link_text ())
160161
161- # Temporarily switch the smtp_from_name setting so we can pretend
162- # the mail came from the author of the comment
163- try :
164- from_name = self ._get_name (comment )
165- self .env .log .debug ("Changing smtp_from_name to %s" % from_name )
166- old_setting = self .config ['notification' ].get ('smtp_from_name' )
167- self .config .set ('notification' , 'smtp_from_name' , from_name )
168- try :
169- NotifyEmail .notify (self , comment , subject )
170- except :
171- pass
172- finally :
173- self .env .log .debug ("Changing smtp_from_name back to %s" %
174- old_setting )
175- self .config .set ('notification' , 'smtp_from_name' , old_setting )
162+ NotifyEmail .notify (self , comment , subject )
163+
164+ def send (self , torcpts , ccrcpts ):
165+ """
166+ Override NotifyEmail.send() so we can provide from_name.
167+ """
168+ self .from_name = self .comment_author
169+ NotifyEmail .send (self , torcpts , ccrcpts )
0 commit comments