From dbd0c1285d7261898d9da9e9e4baa51ebd8f246e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20M=C3=BCller?= Date: Sun, 14 Mar 2021 13:24:24 +0100 Subject: [PATCH] Small formatting and doc tweaks --- FAQ.md | 13 +++++++------ validate_email/smtp_check.py | 8 ++++---- validate_email/validate_email.py | 14 +++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/FAQ.md b/FAQ.md index 9d1bd18..e0c6d20 100644 --- a/FAQ.md +++ b/FAQ.md @@ -62,9 +62,10 @@ This module, however, directly talks to the *recipient's* server for *incoming* emails, so neither your credentials nor the switch to port 465 or 587 is of any use here. -If your internet connection is within a dynamic range (often the case -for private use) or it doesn't have a proper reverse DNS entry, the -servers for many email domains will reject connections from you. This -can *not* be solved by using your provider's mail server. Instead, you -have to use the library on a machine with an internet connection with -static IP address and a proper reverse DNS entry. +If your internet connection is within an IP pool (often the case for +private use) or it doesn't have a proper reverse DNS entry, the servers +for many email domains (depending on their configuration) will reject +connections from you. This can *not* be solved by using your provider's +mail server. Instead, you have to use the library on a machine with an +internet connection with static IP address and a proper reverse DNS +entry. diff --git a/validate_email/smtp_check.py b/validate_email/smtp_check.py index 63473f7..8edda3a 100644 --- a/validate_email/smtp_check.py +++ b/validate_email/smtp_check.py @@ -175,10 +175,10 @@ class _SMTPChecker(SMTP): def smtp_check( - email_address: EmailAddress, mx_records: List[str], - timeout: float = 10, helo_host: Optional[str] = None, - from_address: Optional[EmailAddress] = None, debug: bool = False - ) -> bool: + email_address: EmailAddress, mx_records: List[str], timeout: float = 10, + helo_host: Optional[str] = None, + from_address: Optional[EmailAddress] = None, debug: bool = False +) -> bool: """ Returns `True` as soon as the any of the given server accepts the recipient address. diff --git a/validate_email/validate_email.py b/validate_email/validate_email.py index 2f62b93..d77b272 100644 --- a/validate_email/validate_email.py +++ b/validate_email/validate_email.py @@ -27,12 +27,12 @@ simply accept everything and send a bounce notification later. Hence, a def validate_email_or_fail( - email_address: str, *, check_format: bool = True, - check_blacklist: bool = True, check_dns: bool = True, - dns_timeout: float = 10, check_smtp: bool = True, - smtp_timeout: float = 10, smtp_helo_host: Optional[str] = None, - smtp_from_address: Optional[str] = None, smtp_debug: bool = False - ) -> Optional[bool]: + email_address: str, *, check_format: bool = True, + check_blacklist: bool = True, check_dns: bool = True, + dns_timeout: float = 10, check_smtp: bool = True, + smtp_timeout: float = 10, smtp_helo_host: Optional[str] = None, + smtp_from_address: Optional[str] = None, smtp_debug: bool = False +) -> Optional[bool]: """ Return `True` if the email address validation is successful, `None` if the validation result is ambigious, and raise an exception if the @@ -43,7 +43,7 @@ def validate_email_or_fail( regex_check(email_address=email_address) if check_blacklist: domainlist_check(email_address=email_address) - if not (check_dns or check_smtp): # check_smtp implies check_dns. + if not check_dns and not check_smtp: # check_smtp implies check_dns. return True mx_records = dns_check(email_address=email_address, timeout=dns_timeout) if not check_smtp: