[fix] use the new split_emails method to split emails by comma

This commit is contained in:
Anand Doshi 2015-09-16 19:20:55 +05:30
parent c19afa140d
commit c5f919eb68
4 changed files with 7 additions and 8 deletions

View File

@ -4,7 +4,7 @@ import frappe.utils
import frappe.defaults
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 import _, msgprint, throw
@ -33,7 +33,7 @@ def manage_recurring_documents(doctype, next_date=None, commit=True):
next_date = next_date or nowdate()
date_field = date_field_map[doctype]
condition = " and ifnull(status, '') != 'Stopped'" if doctype in ("Sales Order", "Purchase Order") else ""
recurring_documents = frappe.db.sql("""select name, recurring_id
@ -180,8 +180,7 @@ def convert_to_recurring(doc, posting_date):
def validate_notification_email_id(doc):
if doc.notification_email_address:
email_list = filter(None, [cstr(email).strip() for email in
doc.notification_email_address.replace("\n", "").split(",")])
email_list = split_emails(doc.notification_email_address.replace("\n", ""))
from frappe.utils import validate_email_add
for email in email_list:

View File

@ -20,7 +20,7 @@ class Newsletter(Document):
group by status""", (self.doctype, self.name))) or None
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()
frappe.msgprint(_("Scheduled to send to {0}").format(self.test_email_id))

View File

@ -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;">
Sent via ERPNext
</a>

View File

@ -4,7 +4,7 @@
# For license information, please see license.txt
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
import os
import datetime
@ -98,5 +98,5 @@ def send_email(success, service_name, error_status=None):
if not frappe.db:
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)