renamed email task to mail because of some name collision in smtplib
This commit is contained in:
parent
bae0e3abce
commit
8be97eb781
6 changed files with 19 additions and 18 deletions
|
|
@ -4,12 +4,12 @@ The email task.
|
|||
http://docs.python.org/2/library/email-examples.html
|
||||
"""
|
||||
|
||||
#import smtplib
|
||||
#from email.mime.text import MIMEText
|
||||
import smtplib
|
||||
from email.mime.text import MIMEText
|
||||
from lib.tasks.task import Task
|
||||
|
||||
|
||||
class EmailTask(Task):
|
||||
class MailTask(Task):
|
||||
def __init__(self, **kwargs):
|
||||
if not "type" in kwargs:
|
||||
raise Exception("'type' not in typeDict " + str(kwargs))
|
||||
|
|
@ -19,7 +19,6 @@ class EmailTask(Task):
|
|||
self.recipient = kwargs["args"]["rcpt"]
|
||||
|
||||
def execute(self, msg):
|
||||
'''
|
||||
message = MIMEText(msg)
|
||||
message['Subject'] = 'Warning from Linspector'
|
||||
message['From'] = "warning@linspector.org"
|
||||
|
|
@ -27,13 +26,7 @@ class EmailTask(Task):
|
|||
s = smtplib.SMTP('localhost')
|
||||
s.sendmail("warning@linspector.org", self.recipient, message.as_string())
|
||||
s.quit()
|
||||
'''
|
||||
|
||||
print("Task executed")
|
||||
print(msg)
|
||||
print(self.recipient)
|
||||
pass
|
||||
|
||||
|
||||
def create(taskDict):
|
||||
return EmailTask(**taskDict)
|
||||
return MailTask(**taskDict)
|
||||
Loading…
Add table
Add a link
Reference in a new issue