Merge pull request #25650 from akhilnarang/fix-replyto-communication-reply
fix: set correct Reply-To header for replies
This commit is contained in:
commit
0cbd7c825b
2 changed files with 11 additions and 4 deletions
|
|
@ -278,13 +278,22 @@ class CommunicationEmailMixin:
|
|||
print_format=print_format, print_html=print_html, print_language=print_language
|
||||
)
|
||||
incoming_email_account = self.get_incoming_email_account()
|
||||
|
||||
reply_to = None
|
||||
|
||||
# If this is a reply to an existing email, set reply_to as the sender of the reply
|
||||
if self.in_reply_to:
|
||||
reply_to = self.get_mail_sender_with_displayname()
|
||||
elif incoming_email_account:
|
||||
reply_to = incoming_email_account.email_id
|
||||
|
||||
return {
|
||||
"recipients": recipients,
|
||||
"cc": cc,
|
||||
"bcc": bcc,
|
||||
"expose_recipients": "header",
|
||||
"sender": self.get_mail_sender_with_displayname(),
|
||||
"reply_to": incoming_email_account and incoming_email_account.email_id,
|
||||
"reply_to": reply_to,
|
||||
"subject": self.subject,
|
||||
"content": self.get_content(print_format=print_format),
|
||||
"reference_doctype": self.reference_doctype,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import json
|
|||
import poplib
|
||||
import re
|
||||
import ssl
|
||||
import time
|
||||
from contextlib import suppress
|
||||
from email.header import decode_header
|
||||
|
||||
|
|
@ -152,7 +151,7 @@ class EmailServer:
|
|||
|
||||
def select_imap_folder(self, folder):
|
||||
res = self.imap.select(f'"{folder}"')
|
||||
return res[0] == "OK" # The folder exsits TODO: handle other resoponses too
|
||||
return res[0] == "OK" # The folder exists TODO: handle other responses too
|
||||
|
||||
def logout(self):
|
||||
if cint(self.settings.use_imap):
|
||||
|
|
@ -312,7 +311,6 @@ class EmailServer:
|
|||
return False
|
||||
|
||||
def make_error_msg(self, uid, msg_num):
|
||||
partial_mail = None
|
||||
traceback = frappe.get_traceback(with_context=True)
|
||||
with suppress(Exception):
|
||||
# retrieve headers
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue