lot of small fixes, typo etc. and some more logging in tasks

This commit is contained in:
Johannes Findeisen 2013-11-03 19:59:20 +01:00
commit 1f52f2c931
3 changed files with 7 additions and 6 deletions

View file

@ -54,15 +54,17 @@ class MailTask(Task):
def execute(self, msg, taskArgs):
if "recipient" not in taskArgs:
raise "could not execute Mail Task! No recipient given!"
logger.debug("Eecuting Task!")
message = MIMEText(msg)
message['Subject'] = msg
now = datetime.datetime.now()
message['Date'] = now.strftime("%a, %d %b %Y %H:%M:%S")
#TODO: totally unstable just to use values from core. make checks before...!
message['From'] = self.fromName
message['To'] = taskArgs["recipient"]
s = smtplib.SMTP(self.host, self.port)
s.login(self.userName, self.password)
#s.login(self.userName, self.password)
s.sendmail(self.fromName, taskArgs["recipient"], message.as_string())
s.quit()