From 1f4dd21f3c998a66fc02c2908cf4cbc7a963f53e Mon Sep 17 00:00:00 2001 From: Max Metz Date: Wed, 31 Jul 2024 15:18:47 +0200 Subject: [PATCH] manually overwritting the email address of all recipients of an Email notification with the proxy-mail 'bremencalling@bsmd.de'. This is useful to test the feature before enabling it to the live-system. --- src/server/BreCal/notifications/notifier.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/server/BreCal/notifications/notifier.py b/src/server/BreCal/notifications/notifier.py index c97eeeb..30db745 100644 --- a/src/server/BreCal/notifications/notifier.py +++ b/src/server/BreCal/notifications/notifier.py @@ -415,12 +415,17 @@ class Notifier(): this 'naive' method creates a message and simply sends it to all users in a list of users. Afterwards, the database will be updated, so the shipcall no longer requires a notification. """ - email_tgts = [user.user_email for user in users if user.user_email is not None] + #email_tgts = [user.user_email for user in users if user.user_email is not None] + email_tgts = ["bremencalling@bsmd.de" for user in users if user.user_email is not None] - ship_name, evaluation_message, eta_etd, eta_etd_type = Notifier.prepare_notification_body(notification) + # avoid multi-mails, when (for some reason) multiple users share the same email address. + email_tgts = list(set(email_tgts)) + # prepare and build the Email content content = get_default_html_email() files = [] # optional attachments + ship_name, evaluation_message, eta_etd, eta_etd_type = Notifier.prepare_notification_body(notification) + msg_multipart,msg_content = create_shipcall_evaluation_notification( email_handler, ship_name, evaluation_message, eta_etd, eta_etd_type, content, files=files )