[fix] use the new split_emails method to split emails by comma
This commit is contained in:
parent
87c2d1d634
commit
1194c6ef4b
@ -4,7 +4,7 @@ import frappe.utils
|
|||||||
import frappe.defaults
|
import frappe.defaults
|
||||||
|
|
||||||
from frappe.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, \
|
from frappe.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, \
|
||||||
get_first_day, get_last_day, comma_and
|
get_first_day, get_last_day, comma_and, split_emails
|
||||||
from frappe.model.naming import make_autoname
|
from frappe.model.naming import make_autoname
|
||||||
|
|
||||||
from frappe import _, msgprint, throw
|
from frappe import _, msgprint, throw
|
||||||
@ -180,8 +180,7 @@ def convert_to_recurring(doc, posting_date):
|
|||||||
|
|
||||||
def validate_notification_email_id(doc):
|
def validate_notification_email_id(doc):
|
||||||
if doc.notification_email_address:
|
if doc.notification_email_address:
|
||||||
email_list = filter(None, [cstr(email).strip() for email in
|
email_list = split_emails(doc.notification_email_address.replace("\n", ""))
|
||||||
doc.notification_email_address.replace("\n", "").split(",")])
|
|
||||||
|
|
||||||
from frappe.utils import validate_email_add
|
from frappe.utils import validate_email_add
|
||||||
for email in email_list:
|
for email in email_list:
|
||||||
|
@ -20,7 +20,7 @@ class Newsletter(Document):
|
|||||||
group by status""", (self.doctype, self.name))) or None
|
group by status""", (self.doctype, self.name))) or None
|
||||||
|
|
||||||
def test_send(self, doctype="Lead"):
|
def test_send(self, doctype="Lead"):
|
||||||
self.recipients = self.test_email_id.split(",")
|
self.recipients = frappe.utils.split_emails(self.test_email_id)
|
||||||
self.send_bulk()
|
self.send_bulk()
|
||||||
frappe.msgprint(_("Scheduled to send to {0}").format(self.test_email_id))
|
frappe.msgprint(_("Scheduled to send to {0}").format(self.test_email_id))
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ scheduler_events = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
default_mail_footer = """<div style="padding: 15px; text-align: center;">
|
default_mail_footer = """<div style="text-align: center;">
|
||||||
<a href="https://erpnext.com?source=via_email_footer" target="_blank" style="color: #8d99a6;">
|
<a href="https://erpnext.com?source=via_email_footer" target="_blank" style="color: #8d99a6;">
|
||||||
Sent via ERPNext
|
Sent via ERPNext
|
||||||
</a>
|
</a>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from frappe.utils import get_site_path, cint
|
from frappe.utils import get_site_path, cint, split_emails
|
||||||
from frappe.utils.data import convert_utc_to_user_timezone
|
from frappe.utils.data import convert_utc_to_user_timezone
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
@ -98,5 +98,5 @@ def send_email(success, service_name, error_status=None):
|
|||||||
if not frappe.db:
|
if not frappe.db:
|
||||||
frappe.connect()
|
frappe.connect()
|
||||||
|
|
||||||
recipients = frappe.db.get_value("Backup Manager", None, "send_notifications_to").split(",")
|
recipients = split_emails(frappe.db.get_value("Backup Manager", None, "send_notifications_to"))
|
||||||
frappe.sendmail(recipients=recipients, subject=subject, message=message)
|
frappe.sendmail(recipients=recipients, subject=subject, message=message)
|
||||||
|
Loading…
Reference in New Issue
Block a user