fix: removed changes from queue.py
This commit is contained in:
parent
01aa5ff928
commit
4624e31708
7 changed files with 12 additions and 35 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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')})
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
0
frappe/templates/emails/newsletter.html
Normal file
0
frappe/templates/emails/newsletter.html
Normal file
|
|
@ -12,7 +12,7 @@
|
|||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<table class="email-container" border="0" cellpadding="0" cellspacing="0"
|
||||
width="{% if header or (is_newsletter and not full_width) %}600{% else %}100%{% endif %}">
|
||||
width="{% if header %}600{% else %}100%{% endif %}">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
{{ header or "" }}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue