add send_pgp_newsletter() to shell

This commit is contained in:
Son NK 2020-03-24 21:31:54 +01:00
parent 0acde29443
commit 2261cd2138
1 changed files with 15 additions and 0 deletions

View File

@ -55,6 +55,21 @@ def send_mailbox_newsletter():
LOG.warning("Cannot send to user %s", user)
def send_pgp_newsletter():
for user in User.query.order_by(User.id).all():
if user.notification and user.activated:
try:
LOG.d("Send PGP newsletter to %s", user)
send_email(
user.email,
"Introducing PGP - encrypt your emails so only you can read them",
render("com/newsletter/pgp.txt", user=user),
render("com/newsletter/pgp.html", user=user),
)
except Exception:
LOG.warning("Cannot send to user %s", user)
app = create_app()
with app.app_context():