instead of overwriting the recipient's addresses, the bsmd address will simply (always) be added to the list of recipients.
This commit is contained in:
parent
0d13ffd626
commit
29b611c780
@ -407,6 +407,18 @@ class Notifier():
|
||||
schemas = execute_sql_query_standalone(query=query, param=schemaModel, command_type="execute")
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
def build_email_targets_validation_notification(users)->list[str]:
|
||||
# readout the email address of all users
|
||||
email_tgts = [user.user_email for user in users if user.user_email is not None]
|
||||
|
||||
# additionally, always inform the BSMD
|
||||
email_tgts.append("bremencalling@bsmd.de") # #TODO: for testing, use "bremencalling@bsmd.de". For live system, use "report@bsmd.de"
|
||||
|
||||
# avoid multi-mails, when (for some reason) multiple users share the same email address.
|
||||
email_tgts = list(set(email_tgts))
|
||||
return email_tgts
|
||||
|
||||
@staticmethod
|
||||
def create_and_send_email_notification(email_handler:EmailHandler, pwd:bytes, users:list[model.User], notification:model.Notification, update_database:bool=True, debug:bool=False):
|
||||
"""
|
||||
@ -415,11 +427,8 @@ 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 = ["bremencalling@bsmd.de" for user in users if user.user_email is not None]
|
||||
|
||||
# avoid multi-mails, when (for some reason) multiple users share the same email address.
|
||||
email_tgts = list(set(email_tgts))
|
||||
# get a list of all recipients
|
||||
email_tgts = Notifier.build_email_targets_validation_notification(users)
|
||||
|
||||
# prepare and build the Email content
|
||||
content = get_default_html_email()
|
||||
|
||||
Reference in New Issue
Block a user