From dd9b4920713145e51eeef74063c15d715a746d37 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Wed, 18 Nov 2015 23:14:42 +0200 Subject: Fail silently with invalid emails in cron jobs --- servo/management/commands/cron.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'servo/management/commands') diff --git a/servo/management/commands/cron.py b/servo/management/commands/cron.py index adc6d34..eaed8bd 100755 --- a/servo/management/commands/cron.py +++ b/servo/management/commands/cron.py @@ -6,6 +6,7 @@ from datetime import date, timedelta from django.conf import settings from django.core.files import File from django.core.mail import send_mail +from django.core.validators import validate_email from django.utils.translation import ugettext as _ from django.core.management.base import BaseCommand @@ -22,6 +23,12 @@ def send_table(sender, recipient, subject, table, send_empty=False): if send_empty is False and table.has_body() is False: return + try: + validate_email(sender) + validate_email(recipient) + except Exception: + return + config = Configuration.conf() host, port = Configuration.get_smtp_server() -- cgit v1.2.3