diff --git a/django/core/validators.py b/django/core/validators.py index cd9dba1ee80..f094b7bf07d 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -106,7 +106,7 @@ class EmailValidator(object): if not value or '@' not in value: raise ValidationError(self.message, code=self.code) - user_part, domain_part = value.split('@', 1) + user_part, domain_part = value.rsplit('@', 1) if not self.user_regex.match(user_part): raise ValidationError(self.message, code=self.code) diff --git a/tests/modeltests/validators/tests.py b/tests/modeltests/validators/tests.py index 5b562a87e6a..6b46c53cc36 100644 --- a/tests/modeltests/validators/tests.py +++ b/tests/modeltests/validators/tests.py @@ -31,6 +31,7 @@ TEST_DATA = ( (validate_email, 'test@domain.with.idn.tld.उदाहरण.परीक्षा', None), (validate_email, 'email@localhost', None), (EmailValidator(whitelist=['localdomain']), 'email@localdomain', None), + (validate_email, '"test@test"@example.com', None), (validate_email, None, ValidationError), (validate_email, '', ValidationError),