Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion openwisp_utils/admin_theme/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from smtplib import SMTPRecipientsRefused

from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
from django.utils.html import strip_tags
Expand Down Expand Up @@ -29,9 +30,13 @@ def send_email(
**kwargs,
)
if app_settings.OPENWISP_HTML_EMAIL and body_html:
site = get_current_site(None)
scheme = "http" if settings.DEBUG else "https"
context = dict(
subject=subject,
title=subject,
message=body_html,
site_name=site.name,
site_url=f"{scheme}://{site.domain}",
logo_url=app_settings.OPENWISP_EMAIL_LOGO,
)
context.update(extra_context)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
180 changes: 135 additions & 45 deletions openwisp_utils/admin_theme/templates/openwisp_utils/email_template.html
Original file line number Diff line number Diff line change
@@ -1,87 +1,175 @@
{% load i18n %}
{% load l10n %}
{% load static %}
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% block styles %}
<style type="text/css">
:root {
--muted-fg-color: #777;
--loud-fg-color: #333;
--muted-bg-color: #F2F4F7;
--muted-border-color: #D0D5DD;
}

body {
min-width: 250px;
background: #ffe5e5;
background: #fff;
margin: 0;
padding: 0;
}
.container{
background: #ffe5e5;

.email-info {
margin: 0.9rem auto;
font-size: 0.8em;
font-weight: 400;
color: #777;
text-align: center;
}

.container {
background: #fff;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.box{

.box {
width: auto;
max-width: 650px;
padding: 30px;
background-color: #fcfcfc;
box-sizing: border-box;
box-shadow: 0 15px 25px rgba(256,256, 256,.5);
margin: 30px auto;
max-width: 700px;
padding: 1.5rem 0.94rem 2.1rem 0.94rem;
background-color: #fff;
border-radius: 12px;
border: outset 1px #eee;
margin: 0px auto 1rem auto;
line-height: 27px;
box-shadow: 0px 20px 24px -4px rgba(16, 24, 40, 0.08), 0px 8px 8px -4px rgba(16, 24, 40, 0.03);
}
.logo-container{

.icon-container {
margin: 0 auto;
width: 48px;
height: 48px;
background-color: rgba(254, 240, 199, 1);
border-radius: 24px;
text-align: center;
margin-bottom: 20px;
}
.logo {
max-width: 210px;

.icon-container img {
width: 24px;
height: 18px;
margin-top: 15px;
}

.sysname-container {
width: fit-content;
margin: 1rem auto 0 auto;
background-color: #F2F4F7;
padding: 0 0.5em;
border: solid #D0D5DD 1px;
border-radius: 16px;
color: #777;
font-size: 0.75rem;
line-height: 1.23rem;
}
.call-to-action{

.logo-container {
text-align: center;
margin-top: 30px;
}
.subject{
font-size: medium;
font-weight: 700;
margin: 20px 0;

.logo {
max-width: 104px;
}

.call-to-action {
text-align: center;
margin-top: 1.88rem;
}

.email-title {
font-weight: 600;
font-size: 1.13rem;
width: fit-content;
margin: auto;
padding-top: 0.25rem;
color: #101828;
}

.subtitle {
font-weight: 400;
font-size: 0.88rem;
width: fit-content;
margin: 0 auto 0.88em auto;
color: #475467;
}
.msg{
color: #1b1818;

.msg {
color: #000000;
margin: 20px 0;
font-size: medium;
}
.btn{

.btn {
appearance: button;
text-decoration: none;
color: #fff!important;
background: #333;
border-radius: 4px;
border: 0;
padding: 10px 15px;
font-weight: bold;
font-size: medium;
border: solid #D0D5DD 1px;
border-radius: 8px;
font-weight: 600;
font-size: 1rem;
line-height: 1.5rem;
padding: 0.63rem 1rem;
color: #344054 !important;
box-sizing: border-box;
box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05), inset 0px 0px 0px 1px rgba(16, 24, 40, 0.18), inset 0px -2px 0px rgba(16, 24, 40, 0.05);
}
.btn:hover, .btn:focus {
background: #000;
outline: 0 none;
background: rgba(51, 51, 51, 0.7);

.btn:hover,
.btn:focus {
border-color: #000;
color: #000;
}

a:link:hover {
text-decoration: none;
}

.footer {
height: 40px;
text-align: center;
color: #475467;
}

.footer p {
font-size: 12px;
margin: 0 auto;
line-height: 20px;
}
</style>
{% endblock styles %}
</head>
<body>
{% block body %}
<div class="container">
{% block logo %}
<div class="logo-container">
<img src="{{ logo_url }}" alt="Logo" class="logo">
</div>
{% endblock logo %}
{% block email_info %}
<div class="email-info">This email is sent to <u>{{ recipient_email }}</u> from [{{ site_name }}]</div>
{% endblock email_info %}
<div class="box">
{% block mail_header %}
<div class="logo-container">
<img src="{{ logo_url }}" alt="Logo" class="logo">
<div class="icon-container">
<img src="{{ site_url }}{% static "ui/openwisp/images/email.png" %}" alt="email icon">
</div>
{% if subject %}
<div class="subject">{{ subject }}</div>
<div class="sysname-container">{{ site_name }}</div>
{% if title %}
<div class="email-title">{{ title }}</div>
{% endif %}
{% if subtitle %}
<div class="subtitle">{{ subtitle }}</div>
{% endif %}
{% endblock mail_header %}
{% block mail_body %}
Expand All @@ -94,13 +182,15 @@
</div>
{% endif %}
{% endblock call_to_action %}
{% block mail_footer %}
{% if footer %}
</div>
{% block mail_footer %}
{% if footer %}
<div class="footer">
{{ footer | safe }}
{% endif %}
</div>
{% endif %}
{% endblock mail_footer %}
</div>
{% endblock body %}
</div>
{% endblock body %}
</body>
</html>
Loading