From bef71b7be3253686222a5129550f859f634ce8c4 Mon Sep 17 00:00:00 2001 From: Carlos Quintana Date: Fri, 13 May 2022 10:55:13 +0200 Subject: [PATCH] Update contact instructions on test_email --- app/email_utils.py | 19 +++++++++++++++++-- .../emails/transactional/test-email.html | 2 +- templates/emails/transactional/test-email.txt | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/email_utils.py b/app/email_utils.py index 31fc8f57..ac7f16a8 100644 --- a/app/email_utils.py +++ b/app/email_utils.py @@ -14,6 +14,7 @@ from email.message import Message, EmailMessage from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.utils import make_msgid, formatdate +from flask import url_for from smtplib import SMTP, SMTPException from typing import Tuple, List, Optional, Union @@ -57,6 +58,7 @@ from app.config import ( VERP_PREFIX, VERP_MESSAGE_LIFETIME, VERP_EMAIL_SECRET, + SUPPORT_EMAIL, ) from app.db import Session from app.dns_utils import get_mx_domains @@ -203,11 +205,24 @@ def send_invalid_totp_login_email(user, totp_type): def send_test_email_alias(email, name): + support_page = URL + url_for("dashboard.support_route") send_email( email, f"This email is sent to {email}", - render("transactional/test-email.txt", name=name, alias=email), - render("transactional/test-email.html", name=name, alias=email), + render( + "transactional/test-email.txt", + name=name, + alias=email, + support_email=SUPPORT_EMAIL, + support_page=support_page, + ), + render( + "transactional/test-email.html", + name=name, + alias=email, + support_email=SUPPORT_EMAIL, + support_page=support_page, + ), ) diff --git a/templates/emails/transactional/test-email.html b/templates/emails/transactional/test-email.html index 63c8f1dc..7d0d0b71 100644 --- a/templates/emails/transactional/test-email.html +++ b/templates/emails/transactional/test-email.html @@ -3,6 +3,6 @@ {% block content %} {{ render_text("Hi " + name) }} {{ render_text("This is a test to make sure that you receive emails sent to your alias " + alias + ".") }} - {{ render_text("If you have any questions, feel free to reply to this email.") }} + {{ render_text('If you have any questions, feel free to contact us either by sending an e-mail to ' + support_email + ' or through our support page') }} {% endblock %} diff --git a/templates/emails/transactional/test-email.txt b/templates/emails/transactional/test-email.txt index 998ae3be..4c5b3aaa 100644 --- a/templates/emails/transactional/test-email.txt +++ b/templates/emails/transactional/test-email.txt @@ -5,7 +5,7 @@ Hi {{name}} This is a test to make sure that you receive emails sent to your alias {{alias}}. -If you have any questions, feel free to reply to this email. +If you have any questions, feel free to contact us either by sending an e-mail to {{support_email}} or through our support page: {{support_page}} {% endblock %}