diff --git a/.env.email-gateway b/.env.email-gateway index a170aa7d4fa05e6492581c4d9fb4f4ecadc25679..5478bbbe07342d3b761b7d843067067b24ca9ba3 100644 --- a/.env.email-gateway +++ b/.env.email-gateway @@ -8,6 +8,9 @@ POSTGRES_USER=admin POSTGRES_PASSWORD=password POSTGRES_DB=push_dev +CERN_OIDC_CLIENT_ID=notifications-dev +CERN_OIDC_CLIENT_SECRET=fill-me + DB_USER=admin DB_PASSWORD=password DB_HOST=pg_db diff --git a/Makefile b/Makefile index aa8201cfc1230c82aa07bf0e495dd366dc45a325..527086814068ac172947f3a61d463e6fefd87060 100644 --- a/Makefile +++ b/Makefile @@ -59,9 +59,9 @@ docker-send-email: python scripts/docker-send-email.py .PHONY: docker-send-email -docker-send-mail-gateway: - python scripts/docker-send-mail-gateway.py -.PHONY: docker-send-mail-gateway +docker-send-email-gateway: + python scripts/docker-send-email-gateway.py +.PHONY: docker-send-email-gateway docker-run: python -m notifications_consumer diff --git a/notifications_consumer/processors/email/processor.py b/notifications_consumer/processors/email/processor.py index 76bbb4c98b841652dbca852a28879678461765fb..58042b16f69cb8170a876897a51b6f1b1b0330f0 100644 --- a/notifications_consumer/processors/email/processor.py +++ b/notifications_consumer/processors/email/processor.py @@ -37,6 +37,8 @@ class EmailProcessor(Processor): context = { "message_body": kwargs["message_body"], "sender": f'{kwargs["channel_name"]} - {sender_name}', + "channel_name": kwargs["channel_name"], + "summary": kwargs["summary"], } text_template = Config.TEMPLATES.get_template("email/simple_notification.txt") diff --git a/notifications_consumer/processors/email/templates/notification_body.html b/notifications_consumer/processors/email/templates/notification_body.html index f6e9623a9617637b712f8d9ab1928c9c7ffa7d80..4fd4ec387fe8a44fca05be86728f116b63f9fec5 100644 --- a/notifications_consumer/processors/email/templates/notification_body.html +++ b/notifications_consumer/processors/email/templates/notification_body.html @@ -1,4 +1,9 @@ <table border="0" cellpadding="0" cellspacing="0" style="border-radius: 5px; background: #f9f9f9; min-width: 550px;"> + <td style="padding:10px"> + <p style="line-height: 145%;"> + <b><span style="color: #3071AB;">{{ summary }}</span></b> + </p> + </td> <tr> <td style="padding: 20px"> <p> diff --git a/notifications_consumer/processors/email/templates/simple_notification.html b/notifications_consumer/processors/email/templates/simple_notification.html index 0d061156fef10b0c3c3ac3b0076abd655700252c..ad1312377f9033976f99f2caa50e94f8b72bf461 100644 --- a/notifications_consumer/processors/email/templates/simple_notification.html +++ b/notifications_consumer/processors/email/templates/simple_notification.html @@ -1,5 +1,16 @@ {% extends 'templates/base_email.html' %} {% block content %} - {% include 'email/notification_body.html' %} + <table width="100%"> + <tr style="background: #3071AB;text-align: center;color:white;"> + <td style="padding:10px"> + <a style="text-decoration:none" href="{{ base_url }}/channels/notifications"> + <h3 style="color: white; margin: 0;"> + {{ channel_name }} + </h3> + </a> + </td> + </tr> + </table> + {% include 'email/notification_body.html' %} {% endblock %} diff --git a/notifications_consumer/processors/email/templates/simple_notification.txt b/notifications_consumer/processors/email/templates/simple_notification.txt index c15709d46f784779f66f92f5ef89a65d36aa5a61..1701cee8f2c9b5eb070463189ef8f70440c63899 100644 --- a/notifications_consumer/processors/email/templates/simple_notification.txt +++ b/notifications_consumer/processors/email/templates/simple_notification.txt @@ -1,3 +1,6 @@ +{{ channel_name }} +---------------------------- + {{ message_body }} -----