added config
This commit is contained in:
parent
78361c72ff
commit
5f382da83b
1 changed files with 8 additions and 3 deletions
|
|
@ -4,21 +4,25 @@ The email task.
|
||||||
http://docs.python.org/2/library/email-examples.html
|
http://docs.python.org/2/library/email-examples.html
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import smtplib
|
#import smtplib
|
||||||
from email.mime.text import MIMEText
|
#from email.mime.text import MIMEText
|
||||||
from lib.tasks.task import Task
|
from lib.tasks.task import Task
|
||||||
|
|
||||||
|
|
||||||
class EmailTask(Task):
|
class EmailTask(Task):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
pass
|
||||||
|
'''
|
||||||
if not "type" in kwargs:
|
if not "type" in kwargs:
|
||||||
raise Exception("'type' not in typeDict " + str(kwargs))
|
raise Exception("'type' not in typeDict " + str(kwargs))
|
||||||
if not "args" in kwargs:
|
if not "args" in kwargs:
|
||||||
raise Exception("typeDict " + str(kwargs) + " has nor arguments!")
|
raise Exception("typeDict " + str(kwargs) + " has nor arguments!")
|
||||||
self.set_task_type(kwargs["type"])
|
self.set_task_type(kwargs["type"])
|
||||||
self.recipient = kwargs["args"]["rcpt"]
|
self.recipient = kwargs["args"]["rcpt"]
|
||||||
|
'''
|
||||||
|
|
||||||
def execute_task(self, msg):
|
def execute_task(self, msg):
|
||||||
|
'''
|
||||||
message = MIMEText(msg)
|
message = MIMEText(msg)
|
||||||
message['Subject'] = 'Warning from Linspector'
|
message['Subject'] = 'Warning from Linspector'
|
||||||
message['From'] = "warning@linspector.org"
|
message['From'] = "warning@linspector.org"
|
||||||
|
|
@ -26,7 +30,8 @@ class EmailTask(Task):
|
||||||
s = smtplib.SMTP('localhost')
|
s = smtplib.SMTP('localhost')
|
||||||
s.sendmail("warning@linspector.org", self.recipient, message.as_string())
|
s.sendmail("warning@linspector.org", self.recipient, message.as_string())
|
||||||
s.quit()
|
s.quit()
|
||||||
|
'''
|
||||||
|
pass
|
||||||
|
|
||||||
def create(taskDict):
|
def create(taskDict):
|
||||||
return EmailTask(**taskDict)
|
return EmailTask(**taskDict)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue