From 77d2cbf09c5beda5d6f65c78caed5b971a0618ae Mon Sep 17 00:00:00 2001 From: Julian Rother <julianr@fsmpi.rwth-aachen.de> Date: Tue, 2 Jan 2018 20:24:26 +0100 Subject: [PATCH] Added config option MAIL_ADDRESS_OVERWRITE to simplify notification debugging --- config.py.example | 1 + mail.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config.py.example b/config.py.example index 4fc6783..e4bd79b 100644 --- a/config.py.example +++ b/config.py.example @@ -33,6 +33,7 @@ FSMPI_IP_RANGES = ['137.226.35.192/29', '137.226.75.0/27', '137.226.127.32/27', DISABLE_SCHEDULER = False #MAIL_SERVER = 'mail.fsmpi.rwth-aachen.de' MAIL_FROM = 'Video AG-Website <videoag-it@lists.fsmpi.rwth-aachen.de>' +#MAIL_ADDRESS_OVERWRITE = 'videoag-it@lists.fsmpi.rwth-aachen.de' MAIL_SUFFIX = 'fsmpi.rwth-aachen.de' MAIL_DEFAULT = 'Video AG <videoag@fsmpi.rwth-aachen.de>' MAIL_ADMINS = 'videoag-it@lists.fsmpi.rwth-aachen.de' diff --git a/mail.py b/mail.py index 7b461f9..262db54 100644 --- a/mail.py +++ b/mail.py @@ -17,7 +17,10 @@ def send_message(msgtype, recipients, **kwargs): if 'MAIL_SERVER' not in config: return s = smtplib.SMTP(config['MAIL_SERVER']) - s.send_message(msg) + if config.get('MAIL_ADDRESS_OVERWRITE'): + s.send_message(msg, to_addrs=[config['MAIL_ADDRESS_OVERWRITE']]) + else: + s.send_message(msg) s.quit() except: traceback.print_exc() -- GitLab