added Date to mail header.
This commit is contained in:
parent
194a7197e6
commit
051b6c0e0a
1 changed files with 3 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ The mail task.
|
||||||
http://docs.python.org/2/library/email-examples.html
|
http://docs.python.org/2/library/email-examples.html
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import datetime
|
||||||
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
|
||||||
|
|
@ -21,6 +22,8 @@ class MailTask(Task):
|
||||||
def execute(self, msg):
|
def execute(self, msg):
|
||||||
message = MIMEText(msg)
|
message = MIMEText(msg)
|
||||||
message['Subject'] = 'Warning from Linspector'
|
message['Subject'] = 'Warning from Linspector'
|
||||||
|
now = datetime.datetime.now()
|
||||||
|
message['Date'] = now.strftime("%a, %d %b %Y %H:%M:%S")
|
||||||
message['From'] = "warning@linspector.org"
|
message['From'] = "warning@linspector.org"
|
||||||
message['To'] = self.recipient
|
message['To'] = self.recipient
|
||||||
s = smtplib.SMTP('localhost')
|
s = smtplib.SMTP('localhost')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue