2 # Copyright (C) 2018 rubenwardy
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
18 from flask import render_template, url_for
19 from flask_mail import Message
21 from app.tasks import celery
22 from app.utils import abs_url_for
25 def sendVerifyEmail(newEmail, token):
26 print("Sending verify email!")
27 msg = Message("Verify email address", recipients=[newEmail])
30 This email has been sent to you because someone (hopefully you)
31 has entered your email address as a user's email.
33 If it wasn't you, then just delete this email.
35 If this was you, then please click this link to verify the address:
38 """.format(abs_url_for('users.verify_email', token=token))
40 msg.html = render_template("emails/verify.html", token=token)
44 def sendEmailRaw(to, subject, text, html):
45 from flask_mail import Message
46 msg = Message(subject, recipients=to)
48 msg.body = text or html
50 msg.html = render_template("emails/base.html", subject=subject, content=html)