mirror of
https://github.com/aljazceru/validate_email.git
synced 2025-12-21 07:54:22 +01:00
Ignore SMTPServerDisconnected from smtp.quit()
This exception is raised by smtp.quit() for some smtp servers (for example laposte.net).
This commit is contained in:
@@ -124,7 +124,10 @@ def validate_email(email, check_mx=False, verify=False, debug=False, smtp_timeou
|
|||||||
smtp = smtplib.SMTP(timeout=smtp_timeout)
|
smtp = smtplib.SMTP(timeout=smtp_timeout)
|
||||||
smtp.connect(mx[1])
|
smtp.connect(mx[1])
|
||||||
if not verify:
|
if not verify:
|
||||||
smtp.quit()
|
try:
|
||||||
|
smtp.quit()
|
||||||
|
except smtplib.SMTPServerDisconnected:
|
||||||
|
pass
|
||||||
return True
|
return True
|
||||||
status, _ = smtp.helo()
|
status, _ = smtp.helo()
|
||||||
if status != 250:
|
if status != 250:
|
||||||
|
|||||||
Reference in New Issue
Block a user