diff --git a/daemon.py b/daemon.py index 16ac04b..e0f9875 100755 --- a/daemon.py +++ b/daemon.py @@ -34,20 +34,17 @@ def checkPaper(): def sendMel(msgfile, etat): fp = open(msgfile, 'rb') - # Create a text/plain message msg = MIMEText(fp.read()) fp.close() - # me == the sender's email address - # you == the recipient's email address + me = 'oison@crans.org' + dest = 'respbats@crans.org' msg['Subject'] = '''Etat de l'imprimante thermique : %s''' % etat - msg['From'] = 'oison@crans.org' - msg['To'] = 'arrighi@crans.org' + msg['From'] = me + msg['To'] = dest - # Send the message via our own SMTP server, but don't include the - # envelope header. s = smtplib.SMTP('smtp.crans.org', 25) - s.sendmail('oison@crans.org', ['arrighi@crans.org'], msg.as_string()) + s.sendmail(me, [dest], msg.as_string()) s.quit() def checkPrinter(dejaVu, messageCourant, messagePapier): @@ -111,7 +108,7 @@ if __name__ == "__main__": print("fork #2 failed: %d (%s)" % (e.errno, e.strerror),file=sys.stderr) sys.exit(1) - # start the daemon thread + # start the daemon thread to monitor the printer thHasPaper = threading.Thread(target = checkPaper, name = 'checkPaper') thHasPaper.start() #main loop