From ef75a1b48868f7ca4b2ca44f5f05b2e9d3d25ba5 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 17 Jul 2015 12:16:48 +0530 Subject: [PATCH] [fix] Also match domain when matching message id using In-Reply-To --- frappe/email/doctype/email_account/email_account.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index 0a4358061d..75f54d68c3 100644 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -183,10 +183,11 @@ class EmailAccount(Document): sender_field = None if in_reply_to: - if "@" in in_reply_to: + if "@{0}".format(frappe.local.site) in in_reply_to: # reply to a communication sent from the system - in_reply_to = in_reply_to.split("@", 1)[0] + in_reply_to, domain = in_reply_to.split("@", 1) + if frappe.db.exists("Communication", in_reply_to): parent = frappe.get_doc("Communication", in_reply_to) @@ -242,6 +243,7 @@ class EmailAccount(Document): else: parent = None + # NOTE if parent isn't found and there's no subject match, it is likely that it is a new conversation thread and hence is_first = True communication.is_first = True if parent: