diff --git a/frappe/boot.py b/frappe/boot.py index 5fd03b7ad1..dca136c49c 100644 --- a/frappe/boot.py +++ b/frappe/boot.py @@ -24,8 +24,6 @@ def get_bootinfo(): # system info bootinfo['sysdefaults'] = frappe.defaults.get_defaults() bootinfo['server_date'] = frappe.utils.nowdate() - bootinfo["send_print_in_body_and_attachment"] = frappe.db.get_value("Outgoing Email Settings", - None, "send_print_in_body_and_attachment") if frappe.session['user'] != 'Guest': bootinfo['user_info'] = get_fullnames() diff --git a/frappe/core/doctype/communication/communication.py b/frappe/core/doctype/communication/communication.py index a4740affb8..eabd4e006f 100644 --- a/frappe/core/doctype/communication/communication.py +++ b/frappe/core/doctype/communication/communication.py @@ -118,21 +118,24 @@ def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]', s if hasattr(sent_via, "get_content"): d.content = sent_via.get_content(d) - footer = set_portal_link(sent_via, d) - - send_print_in_body = frappe.db.get_value("Outgoing Email Settings", None, "send_print_in_body_and_attachment") - if print_html and not send_print_in_body: - d.content += "
Please see attachment for document details.
" + footer = "" + _("Please see attachment") + "
" mail = get_email(d.recipients, sender=d.sender, subject=d.subject, - msg=d.content, footer=footer, print_html=print_html if send_print_in_body else None) + msg=d.content, footer=footer) if send_me_a_copy: mail.cc.append(frappe.db.get_value("User", frappe.session.user, "email")) if print_html: print_html = scrub_urls(print_html) - mail.add_attachment(name.replace(' ','').replace('/','-') + '.html', print_html) + + try: + mail.add_pdf_attachment(name.replace(' ','').replace('/','-') + '.pdf', print_html) + except Exception: + frappe.msgprint(_("Error generating PDF, attachment sent as HTML")) + mail.add_attachment(name.replace(' ','').replace('/','-') + '.html', + print_html, 'text/html') for a in json.loads(attachments): try: @@ -145,7 +148,7 @@ def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]', s def set_portal_link(sent_via, comm): """set portal link in footer""" - footer = None + footer = "" if is_signup_enabled() and hasattr(sent_via, "get_portal_page"): portal_page = sent_via.get_portal_page() @@ -154,7 +157,7 @@ def set_portal_link(sent_via, comm): sent_via.get("contact_email")) in comm.recipients if is_valid_recipient: url = "%s/%s?name=%s" % (get_url(), portal_page, urllib.quote(sent_via.name)) - footer = """