Fixes in sendmail
This commit is contained in:
parent
77bf4105a4
commit
4aaf2fa117
1 changed files with 23 additions and 2 deletions
|
|
@ -111,9 +111,22 @@ class SendMail:
|
||||||
|
|
||||||
error=True
|
error=True
|
||||||
|
|
||||||
|
except smtplib.SMTPServerDisconnected as e:
|
||||||
|
|
||||||
|
self.txt_error=e.__str__()
|
||||||
|
|
||||||
|
error=True
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
|
||||||
|
self.txt_error=e.__str__()
|
||||||
|
|
||||||
|
error=True
|
||||||
|
|
||||||
|
|
||||||
if error:
|
if error:
|
||||||
|
|
||||||
self.smtp.quit()
|
self.quit()
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
@ -254,7 +267,15 @@ class SendMail:
|
||||||
"""Function used when you need quit connection for any reason"""
|
"""Function used when you need quit connection for any reason"""
|
||||||
|
|
||||||
if self.smtp!=None:
|
if self.smtp!=None:
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
self.smtp.quit()
|
self.smtp.quit()
|
||||||
|
|
||||||
|
except smtplib.SMTPServerDisconnected as e:
|
||||||
|
print('SMTP: '+e.__str__())
|
||||||
|
|
||||||
|
|
||||||
self.smtp=None
|
self.smtp=None
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue