added core config to jobs and tasks and made use of core variables raw in the tasks
This commit is contained in:
parent
25f83c3ae9
commit
0bfa4b3daa
5 changed files with 23 additions and 21 deletions
|
|
@ -19,14 +19,14 @@ class MailTask(Task):
|
|||
self.set_task_type(kwargs["type"])
|
||||
self.recipient = kwargs["args"]["rcpt"]
|
||||
|
||||
def execute(self, msg):
|
||||
def execute(self, msg, core):
|
||||
message = MIMEText(msg)
|
||||
message['Subject'] = 'Warning from Linspector'
|
||||
message['Subject'] = msg
|
||||
now = datetime.datetime.now()
|
||||
message['Date'] = now.strftime("%a, %d %b %Y %H:%M:%S")
|
||||
message['From'] = "warning@linspector.org"
|
||||
message['From'] = core["tasks"]["mail"]["from"]
|
||||
message['To'] = self.recipient
|
||||
s = smtplib.SMTP('localhost')
|
||||
s = smtplib.SMTP(core["tasks"]["mail"]["host"], core["tasks"]["mail"]["port"])
|
||||
s.sendmail("warning@linspector.org", self.recipient, message.as_string())
|
||||
s.quit()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue