scudre / alarm-central-station-receiver

Python daemon for receiving events from a home alarm system via Contact ID protocol
Apache License 2.0
36 stars 10 forks source link

Gracefully handle email send failures #14

Closed scudre closed 6 years ago

scudre commented 6 years ago

If the email notification send fails, it throws an exception. This could be handled more gracefully. Example of an error:

Traceback (most recent call last): File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python2.7/dist-packages/alarm_central_station_receiver-0.0.8-py2.7-linux-armv7l.egg/alarm_central_station_receiver/notifications/email_notify.py", line 40, in send_email s = smtplib.SMTP(server, server_port) File "/usr/lib/python2.7/smtplib.py", line 256, in init (code, msg) = self.connect(host, port) File "/usr/lib/python2.7/smtplib.py", line 317, in connect (code, msg) = self.getreply() File "/usr/lib/python2.7/smtplib.py", line 368, in getreply raise SMTPServerDisconnected("Connection unexpectedly closed") SMTPServerDisconnected: Connection unexpectedly closed