]> www.vanbest.org Git - motioneye-debian/commitdiff
notifications can now be sent to multiple email addresses
authorCalin Crisan <ccrisan@gmail.com>
Sun, 8 Feb 2015 09:39:26 +0000 (11:39 +0200)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 8 Feb 2015 09:39:26 +0000 (11:39 +0200)
sendmail.py

index 4ecbcb51456967a09cb372502e8c381a14110d89..fe1172b931c6b7ad7b45984876d0096333d22ed4 100755 (executable)
@@ -66,7 +66,7 @@ def send_mail(server, port, account, password, tls, to, subject, message, files)
     email = MIMEMultipart()
     email['Subject'] = subject
     email['From'] = _from
-    email['To'] = to
+    email['To'] = ', '.join(to)
     email.attach(MIMEText(message))
     
     for file in reversed(files):
@@ -138,7 +138,7 @@ if __name__ == '__main__':
     msg_id = sys.argv[7]
     camera_id = sys.argv[8]
     moment = sys.argv[9]
-    
+
     message = messages.get(msg_id)
     subject = subjects.get(msg_id)
     if not message or not subject:
@@ -163,6 +163,9 @@ if __name__ == '__main__':
         logging.info('no email address specified')
         sys.exit(0)
 
+    to = [t.strip() for t in re.split('[,;| ]', to)]
+    to = [t for t in to if t]
+
     io_loop = IOLoop.instance()
     
     def on_message(subject, message, files):