This commit is contained in:
OzzieIsaacs 2018-08-14 17:38:38 +02:00
parent bb5d7d7bc0
commit f8132f4d02

View File

@ -84,16 +84,12 @@ def get_attachment(bookpath, filename):
return attachment return attachment
# Class for sending email with ability to get current progress # Class for sending email with ability to get current progress
class email(smtplib.SMTP): class emailbase():
transferSize = 0 transferSize = 0
progress = 0 progress = 0
def __init__(self, *args, **kwargs):
smtplib.SMTP.__init__(self, *args, **kwargs)
def data(self, msg): def data(self, msg):
self.transferSize = len(msg) self.transferSize = len(msg)
(code, resp) = smtplib.SMTP.data(self, msg) (code, resp) = smtplib.SMTP.data(self, msg)
@ -138,8 +134,15 @@ class email(smtplib.SMTP):
return "100 %" return "100 %"
# Class for sending ssl encrypted email with ability to get current progress # Class for sending email with ability to get current progress, derived from emailbase class
class email_SSL(email, smtplib.SMTP_SSL): class email(emailbase, smtplib.SMTP):
def __init__(self, *args, **kwargs):
smtplib.SMTP.__init__(self, *args, **kwargs)
# Class for sending ssl encrypted email with ability to get current progress, , derived from emailbase class
class email_SSL(emailbase, smtplib.SMTP_SSL):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
smtplib.SMTP_SSL.__init__(self, *args, **kwargs) smtplib.SMTP_SSL.__init__(self, *args, **kwargs)