Skip to content

Commit

Permalink
Add contact form hint to mails (#698)
Browse files Browse the repository at this point in the history
* ➕ Add contact form hint to mails

* ➕ Add reply to header
  • Loading branch information
devmount authored Sep 27, 2024
1 parent 70ebe3f commit 1cd89bc
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 15 deletions.
3 changes: 3 additions & 0 deletions backend/src/appointment/controller/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ def __init__(
self,
to: str,
sender: str = os.getenv('SERVICE_EMAIL'),
reply_to: str = os.getenv('SUPPORT_EMAIL'),
subject: str = '',
html: str = '',
plain: str = '',
attachments: list[Attachment] = [],
):
self.sender = sender
self.to = to
self.reply_to = reply_to
self.subject = subject
self.body_html = html
self.body_plain = plain
Expand All @@ -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())
Expand Down
2 changes: 2 additions & 0 deletions backend/src/appointment/l10n/de/email.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions backend/src/appointment/l10n/en/email.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
1 change: 1 addition & 0 deletions backend/src/appointment/templates/email/confirm.jinja2
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "includes/base.jinja2" %}
{% set show_contact_form_hint = True %}
{# Helper vars #}
{% set clock_image_small = '<img style="width: 11px; height: 11px; position: relative; top: 2px;" alt="" src="cid:%(cid)s" />'|format(cid=clock_icon_cid) %}
{% set clock_image = '<img style="width: 15px; height: 15px; position: relative; top: 2px;" alt="" src="cid:%(cid)s" />'|format(cid=clock_icon_cid) %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% extends "includes/base.jinja2" %}
{% set show_contact_form_hint = True %}
{# Code begins! #}
{% block introduction %}
<div style="color: {{ colour_text_base }}; text-align: center; line-height: 16px;">
<p>{{ l10n('zoom-invite-failed-html-heading', {'title': title}) }}</p>
</div>
{% endblock %}
{% endblock %}
34 changes: 20 additions & 14 deletions backend/src/appointment/templates/email/includes/base.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
background-color: {{ colour_surface_base }};
font-family: 'Inter', sans-serif;
margin: 24px 0;
">
">
<body>
{% if self.introduction()|trim %}
<div style="
margin-left: auto;
margin-right: auto;
margin-bottom: 24px;
">
margin-left: auto;
margin-right: auto;
margin-bottom: 24px;
">
{% block introduction %}{% endblock %}
</div>
{% endif %}
Expand All @@ -35,7 +35,7 @@
border-radius: 6px;
padding: 12px;
background-color: {{ colour_surface_raised }}
">
">
{% block information %}{% endblock %}
</div>
{% endif %}
Expand All @@ -44,15 +44,21 @@
{% block call_to_action %}{% endblock %}
</div>
{% endif %}
{% if show_contact_form_hint %}
{% set link = '<a href="%(url)s">%(label)s</a>'|format(url=homepage_url + '/contact', label=l10n('mail-brand-contact-form')) %}
<div style="text-align: center; margin-left: auto; margin-right: auto; margin-bottom: 24px; padding: 12px; max-width: 310px;">
{{ l10n('mail-brand-support-hint', {'contact_form_link': link})|safe }}
</div>
{% endif %}
<div style="
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%);
"></div>
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%);
"></div>
{% include './includes/footer.jinja2' %}
</body>
</html>
1 change: 1 addition & 0 deletions backend/src/appointment/templates/email/new_account.jinja2
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "includes/base.jinja2" %}
{% set show_contact_form_hint = True %}
{# Code begins! #}
{% block introduction %}
<div style="color: {{ colour_text_base }}; text-align: center; line-height: 16px;">
Expand Down
1 change: 1 addition & 0 deletions backend/src/appointment/templates/email/new_booking.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{% set clock_image_small = '<img style="width: 11px; height: 11px; position: relative; top: 2px;" alt="" src="cid:%(cid)s" />'|format(cid=clock_icon_cid) %}
{% set clock_image = '<img style="width: 15px; height: 15px; position: relative; top: 2px;" alt="" src="cid:%(cid)s" />'|format(cid=clock_icon_cid) %}
{% set calendar_image = '<img style="width: 14px; height: 14px; position: relative; top: 2px;" alt="" src="cid:%(cid)s" />'|format(cid=calendar_icon_cid) %}
{% set show_contact_form_hint = True %}
{# Code begins! #}
{% block introduction %}
<div style="color: {{ colour_text_base }}; text-align: center; line-height: 16px;">
Expand Down

0 comments on commit 1cd89bc

Please sign in to comment.