mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 03:53:50 +00:00 
			
		
		
		
	email: Set an envelope-from which may be different from the From: field.
The envelope-from is used by the MTA if the destination address is not deliverable. Route all such mail to the noreply address.
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							173d2dec3d
						
					
				
				
					commit
					e53be6d043
				
			| @@ -148,7 +148,9 @@ def build_email( | ||||
|     if from_address == FromAddress.support_placeholder: | ||||
|         from_address = FromAddress.SUPPORT | ||||
|  | ||||
|     from_email = str(Address(display_name=from_name, addr_spec=from_address)) | ||||
|     # Set the "From" that is displayed separately from the envelope-from | ||||
|     extra_headers["From"] = str(Address(display_name=from_name, addr_spec=from_address)) | ||||
|  | ||||
|     reply_to = None | ||||
|     if reply_to_email is not None: | ||||
|         reply_to = [reply_to_email] | ||||
| @@ -158,8 +160,9 @@ def build_email( | ||||
|     elif from_address == FromAddress.NOREPLY: | ||||
|         reply_to = [FromAddress.NOREPLY] | ||||
|  | ||||
|     envelope_from = FromAddress.NOREPLY | ||||
|     mail = EmailMultiAlternatives( | ||||
|         email_subject, message, from_email, to_emails, reply_to=reply_to, headers=extra_headers | ||||
|         email_subject, message, envelope_from, to_emails, reply_to=reply_to, headers=extra_headers | ||||
|     ) | ||||
|     if html_message is not None: | ||||
|         mail.attach_alternative(html_message, "text/html") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user