Skip to content

Commit 85f64f9

Browse files
committed
[fix] Fixed the recipient string in email template
1 parent fa9b0df commit 85f64f9

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

openwisp_utils/admin_theme/email.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,18 @@ def send_email(
3232
if app_settings.OPENWISP_HTML_EMAIL and body_html:
3333
site = get_current_site(None)
3434
scheme = "http" if settings.DEBUG else "https"
35+
recipients_str = (
36+
", ".join(recipients[:-1]) + f", & {recipients[-1]}"
37+
if len(recipients) > 2
38+
else " & ".join(recipients)
39+
)
3540
context = dict(
3641
title=subject,
3742
message=body_html,
3843
site_name=site.name,
3944
site_url=f"{scheme}://{site.domain}",
4045
logo_url=app_settings.OPENWISP_EMAIL_LOGO,
46+
recipients=recipients_str,
4147
)
4248
context.update(extra_context)
4349

openwisp_utils/admin_theme/templates/openwisp_utils/email_template.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
}
7979

8080
.logo {
81-
max-width: 104px;
81+
width: 150px;
82+
height: 86px;
8283
}
8384

8485
.call-to-action {
@@ -91,7 +92,7 @@
9192
font-size: 1.13rem;
9293
width: fit-content;
9394
margin: auto;
94-
padding-top: 0.25rem;
95+
margin-top: 1rem;
9596
color: #101828;
9697
}
9798

@@ -156,7 +157,7 @@
156157
</div>
157158
{% endblock logo %}
158159
{% block email_info %}
159-
<div class="email-info">This email is sent to <u>{{ recipient_email }}</u> from [{{ site_name }}]</div>
160+
<div class="email-info">This email is sent to <u>{{ recipients }}</u> from [{{ site_name }}]</div>
160161
{% endblock email_info %}
161162
<div class="box">
162163
{% block mail_header %}

0 commit comments

Comments
 (0)