From aa7df810f4654fb8b5e414cbd2012e0450f9c183 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 16 Jul 2015 19:39:23 +0530 Subject: [PATCH] [enhancement] send reference in email account's auto-reply --- frappe/email/doctype/email_account/email_account.json | 3 ++- frappe/email/doctype/email_account/email_account.py | 5 +++-- frappe/templates/emails/auto_reply.html | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/frappe/email/doctype/email_account/email_account.json b/frappe/email/doctype/email_account/email_account.json index a6879b2af3..3e0e666bc0 100644 --- a/frappe/email/doctype/email_account/email_account.json +++ b/frappe/email/doctype/email_account/email_account.json @@ -388,6 +388,7 @@ { "allow_on_submit": 0, "depends_on": "enable_auto_reply", + "description": "ProTip: Add Reference: {{ reference_doctype }} {{ reference_name }} to send document reference", "fieldname": "auto_reply_message", "fieldtype": "Text Editor", "hidden": 0, @@ -428,7 +429,7 @@ "is_submittable": 0, "issingle": 0, "istable": 0, - "modified": "2015-06-11 00:16:24.026081", + "modified": "2015-07-16 10:11:06.466258", "modified_by": "Administrator", "module": "Email", "name": "Email Account", diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index c072364bcf..9bb2bc5742 100644 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -7,6 +7,7 @@ from frappe import _ from frappe.model.document import Document from frappe.utils import validate_email_add, cint, get_datetime, DATE_FORMAT, strip from frappe.utils.user import is_system_user +from frappe.utils.jinja import render_template from frappe.email.smtp import SMTPServer from frappe.email.receive import POP3Server, Email from poplib import error_proto @@ -252,14 +253,14 @@ class EmailAccount(Document): def send_auto_reply(self, communication, email): """Send auto reply if set.""" - if self.auto_reply_message: + if self.enable_auto_reply: communication.set_incoming_outgoing_accounts() frappe.sendmail(recipients = [email.from_email], sender = self.email_id, reply_to = communication.incoming_email_account, subject = _("Re: ") + communication.subject, - content = self.auto_reply_message or \ + content = render_template(self.auto_reply_message or "", communication.as_dict()) or \ frappe.get_template("templates/emails/auto_reply.html").render(communication.as_dict()), reference_doctype = communication.reference_doctype, reference_name = communication.reference_name, diff --git a/frappe/templates/emails/auto_reply.html b/frappe/templates/emails/auto_reply.html index 394b608e6a..2181694cff 100644 --- a/frappe/templates/emails/auto_reply.html +++ b/frappe/templates/emails/auto_reply.html @@ -1,5 +1,6 @@

{{ _("Thank you for your email") }}

-

{{ _("Your query has been received. We will back reply shortly. If you have any additional information, please reply to this mail.") }}

+

{{ _("Your query has been received. We will reply back shortly. If you have any additional information, please reply to this mail.") }}

+

{{ _("Reference: {0} {1}").format(reference_doctype, reference_name) }}

{{ _("This is an automatically generated reply") }}