@@ -128,7 +128,7 @@ def validate_email_domain_part(domain, test_environment=False, globally_delivera
128
128
try :
129
129
domain = idna .uts46_remap (domain , std3_rules = False , transitional = False )
130
130
except idna .IDNAError as e :
131
- raise EmailSyntaxError ("The domain name %s contains invalid characters (%s )." % ( domain , str (e )))
131
+ raise EmailSyntaxError ("The part after the @-sign contains invalid characters ({} )." . format ( str (e )))
132
132
133
133
# Now we can perform basic checks on the use of periods (since equivalent
134
134
# symbols have been mapped to periods). These checks are needed because the
@@ -166,7 +166,7 @@ def validate_email_domain_part(domain, test_environment=False, globally_delivera
166
166
# one the user supplied. Also I'm not sure if the length check applies
167
167
# to the internationalized form, the IDNA ASCII form, or even both!
168
168
raise EmailSyntaxError ("The email address is too long after the @-sign." )
169
- raise EmailSyntaxError ("The domain name %s contains invalid characters (%s)." % ( domain , str (e ) ))
169
+ raise EmailSyntaxError ("The part after the @-sign contains invalid characters (%s)." % str (e ))
170
170
171
171
# Check the syntax of the string returned by idna.encode.
172
172
# It should never fail.
@@ -186,7 +186,7 @@ def validate_email_domain_part(domain, test_environment=False, globally_delivera
186
186
for label in ascii_domain .split ("." ):
187
187
if len (label ) > DNS_LABEL_LENGTH_LIMIT :
188
188
reason = get_length_reason (label , limit = DNS_LABEL_LENGTH_LIMIT )
189
- raise EmailSyntaxError ("The part of the email address \" {} \" is too long {}." .format (label , reason ))
189
+ raise EmailSyntaxError ("On either side of the @-sign, periods cannot be separated by so many characters {}." .format (reason ))
190
190
191
191
if globally_deliverable :
192
192
# All publicly deliverable addresses have domain named with at least
@@ -223,7 +223,7 @@ def validate_email_domain_part(domain, test_environment=False, globally_delivera
223
223
try :
224
224
domain_i18n = idna .decode (ascii_domain .encode ('ascii' ))
225
225
except idna .IDNAError as e :
226
- raise EmailSyntaxError ("The domain name %s is not valid IDNA (%s )." % ( ascii_domain , str (e )))
226
+ raise EmailSyntaxError ("The part after the @-sign is not valid IDNA ({} )." . format ( str (e )))
227
227
228
228
# Return the IDNA ASCII-encoded form of the domain, which is how it
229
229
# would be transmitted on the wire (except when used with SMTPUTF8
0 commit comments