Fix regarding support ticket to support ticket system email chaining issue
diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py
index f629cbd..fcf4e32 100644
--- a/erpnext/support/doctype/support_ticket/__init__.py
+++ b/erpnext/support/doctype/support_ticket/__init__.py
@@ -40,18 +40,32 @@
 		else:
 			content, content_type = mail.html_content, 'text/html'
 			
-		thread_id = mail.get_thread_id()
+		thread_list = mail.get_thread_id()
 
-		if webnotes.conn.exists('Support Ticket', thread_id):
-			from webnotes.model.code import get_obj
-			
-			st = get_obj('Support Ticket', thread_id)
-			st.make_response_record(content, mail.mail['From'], content_type)
-			webnotes.conn.set(st.doc, 'status', 'Open')
-			update_feed(st.doc)
-			# extract attachments
-			self.save_attachments(st.doc, mail.attachments)
-			return
+
+		email_id = mail.mail['From']
+		if "<" in mail.mail['From']:
+			import re
+			re_result = re.findall('(?<=\<)(\S+)(?=\>)', mail.mail['From'])
+			if re_result and re_result[0]: email_id = res_result[0]
+
+
+		for thread_id in thread_list:
+			exists = webnotes.conn.sql("""\
+				SELECT name
+				FROM `tabSupport Ticket`
+				WHERE name=%s AND raised_by LIKE %s
+				""", (thread_id, "%" + email_id + "%"))
+			if exists and exists[0] and exists[0][0]:
+				from webnotes.model.code import get_obj
+				
+				st = get_obj('Support Ticket', thread_id)
+				st.make_response_record(content, mail.mail['From'], content_type)
+				webnotes.conn.set(st.doc, 'status', 'Open')
+				update_feed(st.doc)
+				# extract attachments
+				self.save_attachments(st.doc, mail.attachments)
+				return
 				
 		# new ticket
 		from webnotes.model.doc import Document