[enhancement] send reference in email account's auto-reply
This commit is contained in:
parent
87aaf010ca
commit
aa7df810f4
3 changed files with 7 additions and 4 deletions
|
|
@ -388,6 +388,7 @@
|
|||
{
|
||||
"allow_on_submit": 0,
|
||||
"depends_on": "enable_auto_reply",
|
||||
"description": "ProTip: Add <code>Reference: {{ reference_doctype }} {{ reference_name }}</code> 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",
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<h3>{{ _("Thank you for your email") }}</h3>
|
||||
<p>{{ _("Your query has been received. We will back reply shortly. If you have any additional information, please reply to this mail.") }}</p>
|
||||
<p>{{ _("Your query has been received. We will reply back shortly. If you have any additional information, please reply to this mail.") }}</p>
|
||||
<p>{{ _("Reference: {0} {1}").format(reference_doctype, reference_name) }}</p>
|
||||
<p style="font-size: 80%; color: #888">
|
||||
{{ _("This is an automatically generated reply") }}
|
||||
</p>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue