fix: use default incoming email account as Reply-To (#36793)
* fix: use default incoming email account as `Reply-To` * chore: set incoming account email as Reply-To --------- Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
This commit is contained in:
parent
6fd9004377
commit
2960865605
3 changed files with 22 additions and 6 deletions
|
|
@ -464,16 +464,16 @@ class EmailAccount(Document):
|
||||||
:param match_by_email: Find account using emailID
|
:param match_by_email: Find account using emailID
|
||||||
:param match_by_doctype: Find account by matching `Append To` doctype
|
:param match_by_doctype: Find account by matching `Append To` doctype
|
||||||
"""
|
"""
|
||||||
doc = cls.find_one_by_filters(enable_incoming=1, email_id=match_by_email)
|
if doc := cls.find_default_incoming():
|
||||||
if doc:
|
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
doc = cls.find_one_by_filters(enable_incoming=1, append_to=match_by_doctype)
|
if match_by_email and (doc := cls.find_one_by_filters(enable_incoming=1, email_id=match_by_email)):
|
||||||
if doc:
|
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
doc = cls.find_default_incoming()
|
if match_by_doctype and (
|
||||||
return doc
|
doc := cls.find_one_by_filters(enable_incoming=1, append_to=match_by_doctype)
|
||||||
|
):
|
||||||
|
return doc
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_default_incoming(cls):
|
def find_default_incoming(cls):
|
||||||
|
|
|
||||||
|
|
@ -260,3 +260,4 @@ execute:from frappe.email.doctype.notification.notification import install_notif
|
||||||
execute:frappe.db.set_value("Email Account", {}, "add_x_original_from", 1)
|
execute:frappe.db.set_value("Email Account", {}, "add_x_original_from", 1)
|
||||||
frappe.patches.v16_0.fix_myanmar_language_name
|
frappe.patches.v16_0.fix_myanmar_language_name
|
||||||
execute:frappe.db.set_value("Email Account", {}, "add_reply_to_header", 1)
|
execute:frappe.db.set_value("Email Account", {}, "add_reply_to_header", 1)
|
||||||
|
frappe.patches.v16_0.set_reply_to_header
|
||||||
|
|
|
||||||
15
frappe/patches/v16_0/set_reply_to_header.py
Normal file
15
frappe/patches/v16_0/set_reply_to_header.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
|
def execute() -> None:
|
||||||
|
accounts = frappe.db.get_all("Email Account", {"enable_incoming": 1, "enable_outgoing": 1}, pluck="name")
|
||||||
|
for account in accounts:
|
||||||
|
doc = frappe.get_doc("Email Account", account)
|
||||||
|
|
||||||
|
if doc.reply_to_addresses:
|
||||||
|
continue
|
||||||
|
|
||||||
|
doc.append("reply_to_addresses", {"email": doc.email_id})
|
||||||
|
doc.flags.ignore_mandatory = True
|
||||||
|
doc.flags.ignore_validate = True # Ignore SMTP/IMAP validation
|
||||||
|
doc.save()
|
||||||
Loading…
Add table
Reference in a new issue