Fix #45, bump version

This commit is contained in:
László Károlyi 2021-02-08 14:19:59 +01:00
parent 072a12f632
commit 0b2b1ba738
Signed by: karolyi
GPG Key ID: 2DCAF25E55735BFE
3 changed files with 14 additions and 7 deletions

View File

@ -1,3 +1,7 @@
0.2.13:
- Fix 5xx errors not getting through in the exception parameters on the RCPT TO
handling. (#45)
0.2.12:
- Fixed a TLS error where the MX hostname mismatched the actual hostname due
to MX records resolving to hostnames with dots at the end. Yahoo lookups

View File

@ -56,7 +56,7 @@ class BuildPyCommand(build_py):
setup(
name='py3-validate-email',
version='0.2.12',
version='0.2.13',
packages=find_packages(exclude=['tests']),
install_requires=['dnspython~=2.0', 'idna~=2.10', 'filelock~=3.0'],
author='László Károlyi',

View File

@ -78,7 +78,7 @@ def _smtp_mail(smtp: SMTP, from_address: EmailAddress):
if code >= 300:
# MAIL FROM bails out, no further SMTP commands are acceptable
message = message.decode(errors='ignore')
raise ProtocolError(f'RCPT TO failed: {message}')
raise ProtocolError(f'MAIL FROM failed: {message}')
def _smtp_converse(
@ -89,7 +89,8 @@ def _smtp_converse(
Do the `SMTP` conversation, handle errors in the caller.
Return a `tuple(code, message)` when ambigious, or raise
`StopIteration` if the conversation points out an existing email.
`ProtocolError` on error, and `StopIteration` if the conversation
points out an existing email.
"""
if debug:
LOGGER.debug(msg=f'Trying {mx_record} ...')
@ -101,10 +102,12 @@ def _smtp_converse(
smtp.quit()
if code == 250:
raise StopIteration
elif 400 <= code <= 499:
# Ambigious return code, can be graylist, temporary problems,
# quota or mailsystem error
return code, message.decode(errors='ignore')
elif code >= 500:
message = message.decode(errors='ignore')
raise ProtocolError(f'RCPT TO failed: {message}')
# Ambigious return code, can be graylist, temporary problems,
# quota or mailsystem error
return code, message.decode(errors='ignore')
def _check_one_mx(