Update eMail.py

Adapting to master-branch (#200)
This commit is contained in:
Florian 2017-01-25 22:03:04 +01:00 committed by GitHub
parent 881d4d7eb0
commit 8724cc64fe

View file

@ -103,12 +103,15 @@ def run(typ,freq,data):
#
# connect to SMTP-Server
#
server = smtplib.SMTP_SSL(globals.config.get("eMail", "smtp_server"), globals.config.get("eMail", "smtp_port"))
try:
server = smtplib.SMTP_SSL(globalVars.config.get("eMail", "smtp_server"), globalVars.config.get("eMail", "smtp_port"))
except:
server = smtplib.SMTP(globalVars.config.get("eMail", "smtp_server"), globalVars.config.get("eMail", "smtp_port"))
# debug-level to shell (0=no debug|1)
server.set_debuglevel(0)
# if tls is enabled, starttls
if globalVars.config.get("eMail", "tls"):
if globalVars.config.getboolean("eMail", "tls"):
server.starttls()
# if user is given, login
@ -184,7 +187,7 @@ def run(typ,freq,data):
return
else:
logging.warning("Invalid Typ: %s", typ)
logging.warning("Invalid Type: %s", typ)
finally:
logging.debug("close eMail-Connection")