mirror of
https://github.com/aljazceru/validate_email.git
synced 2025-12-19 23:14:20 +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.connect(mx[1])
|
||||
if not verify:
|
||||
smtp.quit()
|
||||
try:
|
||||
smtp.quit()
|
||||
except smtplib.SMTPServerDisconnected:
|
||||
pass
|
||||
return True
|
||||
status, _ = smtp.helo()
|
||||
if status != 250:
|
||||
|
||||
Reference in New Issue
Block a user