diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d5b738d..fa045d3 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,6 @@ +1.0.7: +- Handle STARTTLS timeouts: https://gitea.ksol.io/karolyi/py3-validate-email/issues/95 + 1.0.6: - Add the option to exclusively use certain address schemas (IPv4/IPV6) diff --git a/README.md b/README.md index e0987ec..12404bc 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,8 @@ Basic usage: smtp_from_address='my@from.addr.ess', smtp_skip_tls=False, smtp_tls_context=None, - smtp_debug=False) + smtp_debug=False, + address_types=frozenset([IPv4Address, IPv6Address])) ### Parameters @@ -58,7 +59,7 @@ Basic usage: `smtp_debug`: activate smtplib's debug output which always goes to stderr; defaults to `False` -`address_types`: The IP address types to use. pass a `frozenset` if you want to change the default `frozenset([IPv6Address, IPv4Address])`. Useful when you only deliver emails through one interface, but you have dual stack. For an explanation, see [this issue](https://gitea.ksol.io/karolyi/py3-validate-email/issues/94) +`address_types`: The IP address types to use. pass a `frozenset` if you want to change the default `frozenset([IPv6Address, IPv4Address])`. Useful when you only deliver emails through one interface, but you have dual stack. For a detailed explanation, see [this issue](https://gitea.ksol.io/karolyi/py3-validate-email/issues/94). ### Result diff --git a/setup.py b/setup.py index b8e4630..4d8f134 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ class BuildPyCommand(build_py): setup( name='py3-validate-email', - version='1.0.6', + version='1.0.7', packages=find_packages(exclude=['tests']), install_requires=['dnspython~=2.2', 'idna~=3.3', 'filelock~=3.7'], author='László Károlyi', diff --git a/validate_email/smtp_check.py b/validate_email/smtp_check.py index aab80b8..d1722cd 100644 --- a/validate_email/smtp_check.py +++ b/validate_email/smtp_check.py @@ -1,6 +1,7 @@ from logging import getLogger from smtplib import ( SMTP, SMTPNotSupportedError, SMTPResponseException, SMTPServerDisconnected) +from socket import timeout from ssl import SSLContext, SSLError from typing import List, Optional, Tuple @@ -91,7 +92,7 @@ class _SMTPChecker(SMTP): except RuntimeError: # SSL/TLS support is not available to your Python interpreter pass - except SSLError as exc: + except (SSLError, timeout) as exc: raise TLSNegotiationError(exc) def mail(self, sender: str, options: tuple = ()):