Commit 9bfa3aea authored by Adrián Ribao's avatar Adrián Ribao
Browse files

validate emails

parent c8bb1e8f
......@@ -11,6 +11,8 @@ from django.contrib.staticfiles.finders import find
from StringIO import StringIO
#import pynliner
from premailer import Premailer
from django.core.validators import validate_email
from django.core.exceptions import ValidationError
#from django.template.loader import get_template
......@@ -89,12 +91,21 @@ class EmailBackend(NotificationBackendBase):
h.inline_links = inline_links
text = h.handle(html)
return text
def validate_email(self, email):
email = validate_email(email)
except ValidationError:
return False
return True
def send(self, *args, **kwargs):
Sends an email with data as a context for the template.
recipients = kwargs.get('to', [])
recipients = filter(self.validate_email, recipients)
#json_data = json.loads(data)
context = {
'site': Site.objects.get_current()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment