mirror of
https://github.com/NaN-tic/flask-galatea_blog.git
synced 2023-12-14 03:53:04 +01:00
Remove Flask-Mail depends
Use electroni.mail.template in case project send emails when post comments #071570
This commit is contained in:
parent
21ed4cef53
commit
501aded323
12
blog.py
12
blog.py
|
@ -6,7 +6,6 @@ from flask import (Blueprint, render_template, current_app, abort, g,
|
|||
from galatea.tryton import tryton
|
||||
from flask_paginate import Pagination
|
||||
from flask_babel import gettext as _, lazy_gettext
|
||||
from flask_mail import Mail, Message
|
||||
from trytond.config import config as tryton_config
|
||||
from trytond.transaction import Transaction
|
||||
from whoosh import index
|
||||
|
@ -339,15 +338,4 @@ def comment():
|
|||
c.save()
|
||||
flash(_('Comment published successfully.'), 'success')
|
||||
|
||||
mail = Mail(current_app)
|
||||
|
||||
mail_to = current_app.config.get('DEFAULT_MAIL_SENDER')
|
||||
subject = '%s - %s' % (current_app.config.get('TITLE'), _('New comment published'))
|
||||
msg = Message(subject,
|
||||
body = render_template('emails/blog-comment-text.jinja', post=post, comment=comment),
|
||||
html = render_template('emails/blog-comment-html.jinja', post=post, comment=comment),
|
||||
sender = mail_to,
|
||||
recipients = [mail_to])
|
||||
mail.send(msg)
|
||||
|
||||
return redirect(post.canonical_uri.uri)
|
||||
|
|
Loading…
Reference in a new issue