From 4f1a32a1a5897729a0b45168afc949cf4a747e54 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 8 Feb 2015 11:39:26 +0200 Subject: [PATCH] notifications can now be sent to multiple email addresses --- sendmail.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sendmail.py b/sendmail.py index 4ecbcb5..fe1172b 100755 --- a/sendmail.py +++ b/sendmail.py @@ -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): -- 2.39.5