From 1cd89bc61dfca3a88780a5341efc6917bf01e7a4 Mon Sep 17 00:00:00 2001 From: Andreas Date: Fri, 27 Sep 2024 17:28:16 +0200 Subject: [PATCH] Add contact form hint to mails (#698) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ➕ Add contact form hint to mails * ➕ Add reply to header --- backend/src/appointment/controller/mailer.py | 3 ++ backend/src/appointment/l10n/de/email.ftl | 2 ++ backend/src/appointment/l10n/en/email.ftl | 2 ++ .../templates/email/confirm.jinja2 | 1 + .../email/errors/zoom_invite_failed.jinja2 | 3 +- .../templates/email/includes/base.jinja2 | 34 +++++++++++-------- .../templates/email/new_account.jinja2 | 1 + .../templates/email/new_booking.jinja2 | 1 + 8 files changed, 32 insertions(+), 15 deletions(-) diff --git a/backend/src/appointment/controller/mailer.py b/backend/src/appointment/controller/mailer.py index 24c199192..4e646a7aa 100644 --- a/backend/src/appointment/controller/mailer.py +++ b/backend/src/appointment/controller/mailer.py @@ -51,6 +51,7 @@ def __init__( self, to: str, sender: str = os.getenv('SERVICE_EMAIL'), + reply_to: str = os.getenv('SUPPORT_EMAIL'), subject: str = '', html: str = '', plain: str = '', @@ -58,6 +59,7 @@ def __init__( ): self.sender = sender self.to = to + self.reply_to = reply_to self.subject = subject self.body_html = html self.body_plain = plain @@ -84,6 +86,7 @@ def build(self): message['Subject'] = self.subject message['From'] = self.sender message['To'] = self.to + message['Reply-To'] = self.reply_to # add body as html and text parts message.set_content(self.text()) diff --git a/backend/src/appointment/l10n/de/email.ftl b/backend/src/appointment/l10n/de/email.ftl index c37774e1b..57d77f259 100644 --- a/backend/src/appointment/l10n/de/email.ftl +++ b/backend/src/appointment/l10n/de/email.ftl @@ -10,6 +10,8 @@ {-brand-name} {-brand-slogan} {-brand-sign-up-with-url} +mail-brand-contact-form = Kontaktformular +mail-brand-support-hint = Du hast Fragen? Wir helfen gern. Nutze unser { $contact_form_link }, oder antworte einfach auf diese E-Mail für Support. mail-brand-footer = Diese Nachricht wurde gesendet von: {-brand-name} {-brand-slogan} {-brand-sign-up-with-no-url} diff --git a/backend/src/appointment/l10n/en/email.ftl b/backend/src/appointment/l10n/en/email.ftl index cc1258fbf..383f021f0 100644 --- a/backend/src/appointment/l10n/en/email.ftl +++ b/backend/src/appointment/l10n/en/email.ftl @@ -10,6 +10,8 @@ {-brand-name} {-brand-slogan} {-brand-sign-up-with-url} +mail-brand-contact-form = contact form +mail-brand-support-hint = Got questions? We're here to help. Fill out our { $contact_form_link }, or simply reply to this email for support. mail-brand-footer = This message was sent from: {-brand-name} {-brand-slogan} {-brand-sign-up-with-no-url} diff --git a/backend/src/appointment/templates/email/confirm.jinja2 b/backend/src/appointment/templates/email/confirm.jinja2 index 791e67a7b..358e04ec3 100644 --- a/backend/src/appointment/templates/email/confirm.jinja2 +++ b/backend/src/appointment/templates/email/confirm.jinja2 @@ -1,4 +1,5 @@ {% extends "includes/base.jinja2" %} +{% set show_contact_form_hint = True %} {# Helper vars #} {% set clock_image_small = ''|format(cid=clock_icon_cid) %} {% set clock_image = ''|format(cid=clock_icon_cid) %} diff --git a/backend/src/appointment/templates/email/errors/zoom_invite_failed.jinja2 b/backend/src/appointment/templates/email/errors/zoom_invite_failed.jinja2 index 37892e15d..729b5615a 100644 --- a/backend/src/appointment/templates/email/errors/zoom_invite_failed.jinja2 +++ b/backend/src/appointment/templates/email/errors/zoom_invite_failed.jinja2 @@ -1,7 +1,8 @@ {% extends "includes/base.jinja2" %} +{% set show_contact_form_hint = True %} {# Code begins! #} {% block introduction %}

{{ l10n('zoom-invite-failed-html-heading', {'title': title}) }}

-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/backend/src/appointment/templates/email/includes/base.jinja2 b/backend/src/appointment/templates/email/includes/base.jinja2 index 196b9ff54..046f0d61a 100644 --- a/backend/src/appointment/templates/email/includes/base.jinja2 +++ b/backend/src/appointment/templates/email/includes/base.jinja2 @@ -14,14 +14,14 @@ background-color: {{ colour_surface_base }}; font-family: 'Inter', sans-serif; margin: 24px 0; - "> +"> {% if self.introduction()|trim %}
+ margin-left: auto; + margin-right: auto; + margin-bottom: 24px; +"> {% block introduction %}{% endblock %}
{% endif %} @@ -35,7 +35,7 @@ border-radius: 6px; padding: 12px; background-color: {{ colour_surface_raised }} - "> +"> {% block information %}{% endblock %} {% endif %} @@ -44,15 +44,21 @@ {% block call_to_action %}{% endblock %} {% endif %} +{% if show_contact_form_hint %} +{% set link = '%(label)s'|format(url=homepage_url + '/contact', label=l10n('mail-brand-contact-form')) %} +
+ {{ l10n('mail-brand-support-hint', {'contact_form_link': link})|safe }} +
+{% endif %}
+ display: block; + width: 100%; + padding-bottom: 1px; + border-radius: unset; + margin-top: 12px; + margin-bottom: 12px; + background: linear-gradient(90deg, rgba(21, 66, 124, 0) 20.5%, rgba(21, 66, 124, 0.2) 50%, rgba(21, 66, 124, 0) 79.5%); +"> {% include './includes/footer.jinja2' %} diff --git a/backend/src/appointment/templates/email/new_account.jinja2 b/backend/src/appointment/templates/email/new_account.jinja2 index b68dc60a4..1a06fc80e 100644 --- a/backend/src/appointment/templates/email/new_account.jinja2 +++ b/backend/src/appointment/templates/email/new_account.jinja2 @@ -1,4 +1,5 @@ {% extends "includes/base.jinja2" %} +{% set show_contact_form_hint = True %} {# Code begins! #} {% block introduction %}
diff --git a/backend/src/appointment/templates/email/new_booking.jinja2 b/backend/src/appointment/templates/email/new_booking.jinja2 index d3d4cb0f9..df2db85bb 100644 --- a/backend/src/appointment/templates/email/new_booking.jinja2 +++ b/backend/src/appointment/templates/email/new_booking.jinja2 @@ -3,6 +3,7 @@ {% set clock_image_small = ''|format(cid=clock_icon_cid) %} {% set clock_image = ''|format(cid=clock_icon_cid) %} {% set calendar_image = ''|format(cid=calendar_icon_cid) %} +{% set show_contact_form_hint = True %} {# Code begins! #} {% block introduction %}