Merged in [8254] from rjsparks@nostrum.com:\n Don't send mail to unknown-email-* addresses. Fixes bug #1471.
- Legacy-Id: 8365 Note: SVN reference [8254] has been migrated to Git commit f7f29a62588eac9b2aaf26cd0401a910fa48403f
This commit is contained in:
parent
9f2ad03748
commit
4cc4f5080c
|
@ -13,7 +13,7 @@ from ietf.utils.accesstoken import generate_access_token
|
|||
def submission_confirmation_email_list(submission):
|
||||
try:
|
||||
doc = Document.objects.get(name=submission.name)
|
||||
email_list = [i.author.formatted_email() for i in doc.documentauthor_set.all()]
|
||||
email_list = [i.author.formatted_email() for i in doc.documentauthor_set.all() if not i.author.invalid_address()]
|
||||
except Document.DoesNotExist:
|
||||
email_list = [u"%s <%s>" % (author["name"], author["email"])
|
||||
for author in submission.authors_parsed() if author["email"]]
|
||||
|
|
|
@ -13,10 +13,10 @@ from ietf.utils.test_utils import login_testing_unauthorized
|
|||
from ietf.utils.test_data import make_test_data
|
||||
from ietf.utils.mail import outbox
|
||||
from ietf.utils.test_utils import TestCase
|
||||
from ietf.submit.utils import expirable_submissions, expire_submission
|
||||
from ietf.submit.utils import expirable_submissions, expire_submission, ensure_person_email_info_exists
|
||||
from ietf.person.models import Person
|
||||
from ietf.group.models import Group
|
||||
from ietf.doc.models import Document, DocEvent, State, BallotDocEvent, BallotPositionDocEvent
|
||||
from ietf.doc.models import Document, DocEvent, State, BallotDocEvent, BallotPositionDocEvent, DocumentAuthor
|
||||
from ietf.submit.models import Submission, Preapproval
|
||||
|
||||
class SubmitTests(TestCase):
|
||||
|
@ -179,6 +179,10 @@ class SubmitTests(TestCase):
|
|||
draft = make_test_data()
|
||||
prev_author = draft.documentauthor_set.all()[0]
|
||||
|
||||
# Make it such that one of the previous authors has an invalid email address
|
||||
bogus_email = ensure_person_email_info_exists('Bogus Person',None)
|
||||
DocumentAuthor.objects.create(document=draft,author=bogus_email,order=draft.documentauthor_set.latest('order').order+1)
|
||||
|
||||
# pretend IANA reviewed it
|
||||
draft.set_state(State.objects.get(used=True, type="draft-iana-review", slug="not-ok"))
|
||||
|
||||
|
@ -225,6 +229,8 @@ class SubmitTests(TestCase):
|
|||
# submitter and new author can't confirm
|
||||
self.assertTrue("author@example.com" not in confirm_email["To"])
|
||||
self.assertTrue("submitter@example.com" not in confirm_email["To"])
|
||||
# Verify that mail wasn't sent to know invalid addresses
|
||||
self.assertTrue("unknown-email-" not in confirm_email["To"])
|
||||
|
||||
confirm_url = self.extract_confirm_url(confirm_email)
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ def send_smtp(msg, bcc=None):
|
|||
addrlist = msg.get_all('To') + msg.get_all('Cc', [])
|
||||
if bcc:
|
||||
addrlist += [bcc]
|
||||
to = [addr for name, addr in getaddresses(addrlist) if addr != '' ]
|
||||
to = [addr for name, addr in getaddresses(addrlist) if ( addr != '' and not addr.startswith('unknown-email-') )]
|
||||
if not to:
|
||||
log("No addressees for email from '%s', subject '%s'. Nothing sent." % (frm, msg.get('Subject', '[no subject]')))
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue