|  | @@ -5,6 +5,7 @@ import typing
 | 
	
		
			
			| 5 | 5 |  from email.header import Header
 | 
	
		
			
			| 6 | 6 |  from email.mime.multipart import MIMEMultipart
 | 
	
		
			
			| 7 | 7 |  from email.mime.text import MIMEText
 | 
	
		
			
			|  | 8 | +from email.utils import formataddr
 | 
	
		
			
			| 8 | 9 |  
 | 
	
		
			
			| 9 | 10 |  from lxml.html.diff import htmldiff
 | 
	
		
			
			| 10 | 11 |  
 | 
	
	
		
			
			|  | @@ -270,7 +271,16 @@ class EmailNotifier(object):
 | 
	
		
			
			| 270 | 271 |          for role in notifiable_roles:
 | 
	
		
			
			| 271 | 272 |              logger.info(self, 'Sending email to {}'.format(role.user.email))
 | 
	
		
			
			| 272 | 273 |              to_addr = '{name} <{email}>'.format(name=role.user.display_name, email=role.user.email)
 | 
	
		
			
			|  | 274 | +            #
 | 
	
		
			
			|  | 275 | +            # INFO - G.M - 2017-11-15 - set content_id in header to permit reply
 | 
	
		
			
			|  | 276 | +            # references can have multiple values, but only one in this case.
 | 
	
		
			
			|  | 277 | +            replyto_addr = self._global_config.EMAIL_NOTIFICATION_REPLY_TO_EMAIL.replace( # nopep8
 | 
	
		
			
			|  | 278 | +                '{content_id}',str(content.content_id)
 | 
	
		
			
			|  | 279 | +            )
 | 
	
		
			
			| 273 | 280 |  
 | 
	
		
			
			|  | 281 | +            reference_addr = self._global_config.EMAIL_NOTIFICATION_REFERENCES_EMAIL.replace( #nopep8
 | 
	
		
			
			|  | 282 | +                '{content_id}',str(content.content_id)
 | 
	
		
			
			|  | 283 | +             )
 | 
	
		
			
			| 274 | 284 |              #
 | 
	
		
			
			| 275 | 285 |              #  INFO - D.A. - 2014-11-06
 | 
	
		
			
			| 276 | 286 |              # We do not use .format() here because the subject defined in the .ini file
 | 
	
	
		
			
			|  | @@ -287,7 +297,14 @@ class EmailNotifier(object):
 | 
	
		
			
			| 287 | 297 |              message['Subject'] = subject
 | 
	
		
			
			| 288 | 298 |              message['From'] = self._get_sender(user)
 | 
	
		
			
			| 289 | 299 |              message['To'] = to_addr
 | 
	
		
			
			| 290 |  | -
 | 
	
		
			
			|  | 300 | +            message['Reply-to'] = formataddr(('',replyto_addr))
 | 
	
		
			
			|  | 301 | +            # INFO - G.M - 2017-11-15
 | 
	
		
			
			|  | 302 | +            # References can theorically have label, but in pratice, references
 | 
	
		
			
			|  | 303 | +            # contains only message_id from parents post in thread.
 | 
	
		
			
			|  | 304 | +            # To link this email to a content we create a virtual parent
 | 
	
		
			
			|  | 305 | +            # in reference who contain the content_id.
 | 
	
		
			
			|  | 306 | +            message['References'] = formataddr(('',reference_addr))
 | 
	
		
			
			|  | 307 | +            # TODO: add correct header to allow reply
 | 
	
		
			
			| 291 | 308 |              body_text = self._build_email_body(self._global_config.EMAIL_NOTIFICATION_CONTENT_UPDATE_TEMPLATE_TEXT, role, content, user)
 | 
	
		
			
			| 292 | 309 |  
 | 
	
		
			
			| 293 | 310 |  
 |