email stuff
This commit is contained in:
parent
332a731977
commit
ccc578e963
@ -5,6 +5,9 @@ from time import gmtime, strftime, sleep
|
||||
import threading
|
||||
import datetime
|
||||
import pymongo
|
||||
import smtplib
|
||||
from email.mime.text import MIMEText
|
||||
|
||||
|
||||
|
||||
DEBUG = True
|
||||
@ -114,6 +117,14 @@ class AlarmSender(threading.Thread):
|
||||
while True:
|
||||
try:
|
||||
msg = self.queue.get()
|
||||
emailMsg = MIMEText("Temperature in freezer to high: %s %s" % (msg['timestamp'], msg['temperature']))
|
||||
emailMsg['Subject'] = 'Freezer Alarm'
|
||||
emailMsg['From'] = 'freezer@hottis.de'
|
||||
emailMsg['To'] = 'familie@hottis.de'
|
||||
s = smtplib.SMTP('localhost')
|
||||
s.sendmail('freezer@hottis.de', ['familie@hottis.de'], emailMsg.as_string())
|
||||
s.quit()
|
||||
|
||||
Logger.debug("AlarmSender sends message for: %s" % msg)
|
||||
except TypeError, e:
|
||||
Logger.log("Exception %s in AlarmSender, run" % str(e))
|
||||
|
Loading…
x
Reference in New Issue
Block a user