mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22:24 +01:00
Add email template
This commit is contained in:
parent
fbf374ff5d
commit
014370ea06
@ -15,7 +15,7 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from flask import *
|
||||
from flask import render_template
|
||||
from flask_mail import Message
|
||||
from app import mail
|
||||
from app.tasks import celery
|
||||
@ -32,8 +32,10 @@ def sendVerifyEmail(newEmail, token):
|
||||
def sendEmailRaw(to, subject, text, html):
|
||||
from flask_mail import Message
|
||||
msg = Message(subject, recipients=to)
|
||||
|
||||
if text:
|
||||
msg.body = text
|
||||
if html:
|
||||
msg.html = html
|
||||
|
||||
html = html or text
|
||||
msg.html = render_template("emails/base.html", subject=subject, content=html)
|
||||
mail.send(msg)
|
||||
|
64
app/templates/emails/base.html
Normal file
64
app/templates/emails/base.html
Normal file
@ -0,0 +1,64 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
.btn {
|
||||
display: inline-block !important;
|
||||
color: #fff !important;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
background-color: transparent;
|
||||
border: 1px solid transparent;
|
||||
border-top-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
border-left-color: transparent;
|
||||
padding: 0.375rem 0.75rem;
|
||||
font-size: 0.9375rem;
|
||||
line-height: 1.5;
|
||||
border-radius: 0.25rem;
|
||||
-webkit-transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
|
||||
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
|
||||
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
||||
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
|
||||
background-color: #2C3E50;
|
||||
border-color: #2C3E50;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
color: #fff;
|
||||
background-color: #1e2b37;
|
||||
border-color: #1a252f;
|
||||
}
|
||||
|
||||
.btn:focus {
|
||||
-webkit-box-shadow: 0 0 0 0.2rem rgba(76, 91, 106, 0.5);
|
||||
box-shadow: 0 0 0 0.2rem rgba(76, 91, 106, 0.5);
|
||||
outline: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="font-family: 'Arial', 'sans-serif'; max-width: 700px; margin: auto; padding: 0;">
|
||||
<div style="background: #2C3E50; padding: 1.2rem 1.2rem 1.2rem 2em; color: white;">
|
||||
<h1 style="margin: 0; font-size: 120%; font-weight: normal;">ContentDB</h1>
|
||||
</div>
|
||||
<div style="padding: 2em; background: white;">
|
||||
{% block content %}
|
||||
<h2 style="margin-top: 0;">{{ subject }}</h2>
|
||||
|
||||
{{ content | safe }}
|
||||
{% endblock %}
|
||||
|
||||
<div style="margin-top: 3em;font-size: 80%;color: #666;">
|
||||
ContentDB © rubenwardy
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,4 +1,7 @@
|
||||
<h1>Hello!</h1>
|
||||
{% extends "emails/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2 style="margin-top: 0;">Hello!</h2>
|
||||
|
||||
<p>
|
||||
This email has been sent to you because someone (hopefully you)
|
||||
@ -6,12 +9,19 @@
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If this was you, then please click this link to verify the address:
|
||||
<a href="{{ url_for('verify_email_page', token=token, _external=True) }}">
|
||||
{{ url_for('verify_email_page', token=token, _external=True) }}
|
||||
</a>
|
||||
If it wasn't you, then just delete this email.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If it wasn't you, then just delete this email.
|
||||
If this was you, then please click this link to verify the address:
|
||||
</p>
|
||||
|
||||
<a class="btn" href="{{ url_for('verify_email_page', token=token, _external=True) }}">
|
||||
Confirm Email Address
|
||||
</a>
|
||||
|
||||
<p style="font-size: 80%;">
|
||||
Or paste this into your browser: {{ url_for('verify_email_page', token=token, _external=True) }}
|
||||
<p>
|
||||
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user