diff --git a/frappe/__init__.py b/frappe/__init__.py index f8ae6b4ec1..992f99131f 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -509,7 +509,7 @@ def sendmail(recipients=[], sender="", subject="No Subject", message="No Message from frappe.email import queue queue.send(recipients=recipients, sender=sender, subject=subject, message=message, text_content=text_content, - reference_doctype = doctype or reference_doctype, reference_name = name or reference_name, + reference_doctype = doctype or reference_doctype, reference_name = name or reference_name, add_unsubscribe_link=add_unsubscribe_link, unsubscribe_method=unsubscribe_method, unsubscribe_params=unsubscribe_params, unsubscribe_message=unsubscribe_message, attachments=attachments, reply_to=reply_to, cc=cc, bcc=bcc, message_id=message_id, in_reply_to=in_reply_to, send_after=send_after, expose_recipients=expose_recipients, send_priority=send_priority, diff --git a/frappe/email/doctype/newsletter/newsletter.json b/frappe/email/doctype/newsletter/newsletter.json index c0383a7d75..dcd19ed33c 100644 --- a/frappe/email/doctype/newsletter/newsletter.json +++ b/frappe/email/doctype/newsletter/newsletter.json @@ -22,7 +22,6 @@ "section_break_13", "send_unsubscribe_link", "send_attachments", - "full_width", "column_break_9", "published", "send_webview_link", @@ -176,12 +175,6 @@ "fieldtype": "Check", "label": "Send Web View Link" }, - { - "default": "0", - "fieldname": "full_width", - "fieldtype": "Check", - "label": "Full Width" - }, { "fieldname": "section_break_13", "fieldtype": "Section Break" @@ -194,7 +187,7 @@ "is_published_field": "published", "links": [], "max_attachments": 3, - "modified": "2021-01-20 20:21:53.535828", + "modified": "2021-02-22 14:33:56.095380", "modified_by": "Administrator", "module": "Email", "name": "Newsletter", diff --git a/frappe/email/doctype/newsletter/newsletter.py b/frappe/email/doctype/newsletter/newsletter.py index eee71d038c..f2657fec3b 100755 --- a/frappe/email/doctype/newsletter/newsletter.py +++ b/frappe/email/doctype/newsletter/newsletter.py @@ -68,14 +68,13 @@ class Newsletter(WebsiteGenerator): except IOError: frappe.throw(_("Unable to find attachment {0}").format(file.name)) - send(recipients=self.recipients, sender=sender, - subject=self.subject, message=self.get_message(), + frappe.sendmail(recipients=self.recipients, sender=sender, + subject=self.subject, message=self.get_message(), template="newsletter", reference_doctype=self.doctype, reference_name=self.name, add_unsubscribe_link=self.send_unsubscribe_link, attachments=attachments, unsubscribe_method="/unsubscribe", unsubscribe_params={"name": self.name}, - send_priority=0, queue_separately=True, add_web_link=self.send_webview_link, - is_newsletter=True, full_width=self.full_width) + send_priority=0, queue_separately=True) if not frappe.flags.in_test: frappe.db.auto_commit_on_many_writes = False diff --git a/frappe/email/email_body.py b/frappe/email/email_body.py index 49b6133c91..8ac071fa61 100755 --- a/frappe/email/email_body.py +++ b/frappe/email/email_body.py @@ -249,8 +249,7 @@ class EMail: return self.msg_root.as_string(policy=policy.SMTPUTF8) def get_formatted_html(subject, message, footer=None, print_html=None, - email_account=None, header=None, unsubscribe_link=None, sender=None, - web_link=None, is_newsletter=False, full_width=False): + email_account=None, header=None, unsubscribe_link=None, sender=None): if not email_account: email_account = get_outgoing_email_account(False, sender=sender) @@ -258,12 +257,10 @@ def get_formatted_html(subject, message, footer=None, print_html=None, "header": get_header(header), "content": message, "signature": get_signature(email_account), - "footer": get_footer(email_account, footer, web_link), + "footer": get_footer(email_account, footer), "title": subject, "print_html": print_html, - "subject": subject, - "is_newsletter": is_newsletter, - "full_width": full_width + "subject": subject }) html = scrub_urls(rendered_email) @@ -360,7 +357,7 @@ def get_signature(email_account): else: return "" -def get_footer(email_account, footer=None, web_link=None): +def get_footer(email_account, footer=None): """append a footer (signature)""" footer = footer or "" @@ -373,9 +370,6 @@ def get_footer(email_account, footer=None, web_link=None): if company_address: args.update({'company_address': company_address}) - - if web_link: - args.update({'web_link': web_link}) if not cint(frappe.db.get_default("disable_standard_email_footer")): args.update({'default_mail_footer': frappe.get_hooks('default_mail_footer')}) diff --git a/frappe/email/queue.py b/frappe/email/queue.py index 71a9054e0b..483d424464 100755 --- a/frappe/email/queue.py +++ b/frappe/email/queue.py @@ -24,7 +24,7 @@ def send(recipients=None, sender=None, subject=None, message=None, text_content= attachments=None, reply_to=None, cc=None, bcc=None, message_id=None, in_reply_to=None, send_after=None, expose_recipients=None, send_priority=1, communication=None, now=False, read_receipt=None, queue_separately=False, is_notification=False, add_unsubscribe_link=1, inline_images=None, - header=None, print_letterhead=False, is_newsletter=False, full_width=False, add_web_link=False): + header=None, print_letterhead=False): """Add email to sending queue (Email Queue) :param recipients: List of recipients. @@ -48,9 +48,6 @@ def send(recipients=None, sender=None, subject=None, message=None, text_content= :param add_unsubscribe_link: Send unsubscribe link in the footer of the Email, default 1. :param inline_images: List of inline images as {"filename", "filecontent"}. All src properties will be replaced with random Content-Id :param header: Append header in email (boolean) - :param is_newsletter: Indicates if email is for newsletter - :param full_width: Will make newsletter email appear with full width on screen - :param add_web_link: Will add web view link to newsletter email """ if not unsubscribe_method: unsubscribe_method = "/api/method/frappe.email.queue.unsubscribe" @@ -130,15 +127,9 @@ def send(recipients=None, sender=None, subject=None, message=None, text_content= if should_append_unsubscribe: unsubscribe_link = get_unsubscribe_message(unsubscribe_message, expose_recipients) email_text_context += unsubscribe_link.text - - web_link = None - if add_web_link and reference_doctype and reference_doctype == "Newsletter": - web_link = get_url(uri = "/newsletters/{0}".format(reference_name)) email_content = get_formatted_html(subject, message, - email_account=email_account, header=header, - unsubscribe_link=unsubscribe_link, web_link=web_link, - is_newsletter=is_newsletter, full_width=full_width) + email_account=email_account, header=header) # add to queue add(recipients, sender, subject, diff --git a/frappe/templates/emails/newsletter.html b/frappe/templates/emails/newsletter.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/frappe/templates/emails/standard.html b/frappe/templates/emails/standard.html index e1a5b483c5..affabbc4c6 100644 --- a/frappe/templates/emails/standard.html +++ b/frappe/templates/emails/standard.html @@ -12,7 +12,7 @@ + width="{% if header %}600{% else %}100%{% endif %}">
{{ header or "" }}