validate the sender email id (#3862)

This commit is contained in:
Manas Solanki 2017-08-07 13:36:03 +05:30 committed by Rushabh Mehta
parent 8dc9645cdb
commit c9df03b60d

View file

@ -14,6 +14,7 @@ from frappe.utils.scheduler import log
from frappe.email.queue import send
from frappe.email.doctype.email_group.email_group import add_subscribers
from frappe.utils import parse_addr
from frappe.utils import validate_email_add
class Newsletter(Document):
@ -23,6 +24,10 @@ class Newsletter(Document):
from `tabEmail Queue` where reference_doctype=%s and reference_name=%s
group by status""", (self.doctype, self.name))) or None
def validate(self):
if self.send_from:
validate_email_add(self.send_from, True)
def test_send(self, doctype="Lead"):
self.recipients = frappe.utils.split_emails(self.test_email_id)
self.queue_all()