@@ -128,7 +128,7 @@ def validate_email_domain_part(domain, test_environment=False, globally_delivera
128128 try :
129129 domain = idna .uts46_remap (domain , std3_rules = False , transitional = False )
130130 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 )))
132132
133133 # Now we can perform basic checks on the use of periods (since equivalent
134134 # 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
166166 # one the user supplied. Also I'm not sure if the length check applies
167167 # to the internationalized form, the IDNA ASCII form, or even both!
168168 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 ))
170170
171171 # Check the syntax of the string returned by idna.encode.
172172 # It should never fail.
@@ -186,7 +186,7 @@ def validate_email_domain_part(domain, test_environment=False, globally_delivera
186186 for label in ascii_domain .split ("." ):
187187 if len (label ) > DNS_LABEL_LENGTH_LIMIT :
188188 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 ))
190190
191191 if globally_deliverable :
192192 # 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
223223 try :
224224 domain_i18n = idna .decode (ascii_domain .encode ('ascii' ))
225225 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 )))
227227
228228 # Return the IDNA ASCII-encoded form of the domain, which is how it
229229 # would be transmitted on the wire (except when used with SMTPUTF8
0 commit comments