Skip to content

Commit

Permalink
✨ Improved email spam-score
Browse files Browse the repository at this point in the history
  • Loading branch information
mawoka-myblock committed Mar 12, 2024
1 parent 8c6608e commit 65f3400
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions classquiz/emails/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
#
# SPDX-License-Identifier: MPL-2.0


import os
import smtplib
import ssl
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import formatdate

from jinja2 import Environment, PackageLoader, select_autoescape

Expand All @@ -28,6 +27,7 @@ def _sendMail(template: str, to: str, subject: str):
msg["Subject"] = subject
msg["From"] = settings.mail_address
msg["To"] = to
msg["Date"] = formatdate(localtime=True)
msg.attach(MIMEText(template, "html"))
context = ssl.SSLContext(ssl.PROTOCOL_TLS)
server = smtplib.SMTP(host=settings.mail_server, port=settings.mail_port)
Expand Down
2 changes: 2 additions & 0 deletions classquiz/emails/templates/forgotten_password.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
SPDX-License-Identifier: MPL-2.0
-->
<html>
<div style='box-sizing: border-box;display: block;max-width: 600px;margin: 0 auto;padding: 10px'><span
style='color: transparent;height: 0;max-height: 0;max-width: 0;opacity: 0;overflow: hidden;mso-hide: all;visibility: hidden;width: 0'>Let's confirm your email address.</span>
<div style='box-sizing: border-box;width: 100%;margin-bottom: 30px;margin-top: 15px'>
Expand Down Expand Up @@ -76,3 +77,4 @@ SPDX-License-Identifier: MPL-2.0
{% include 'footer.jinja2' %}

</div>
</html>
3 changes: 2 additions & 1 deletion classquiz/emails/templates/register.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
SPDX-License-Identifier: MPL-2.0
-->

<html>
<div style='box-sizing: border-box;display: block;max-width: 600px;margin: 0 auto;padding: 10px'><span
style='color: transparent;height: 0;max-height: 0;max-width: 0;opacity: 0;overflow: hidden;mso-hide: all;visibility: hidden;width: 0'>Let's confirm your email address.</span>
<div style='box-sizing: border-box;width: 100%;margin-bottom: 30px;margin-top: 15px'>
Expand Down Expand Up @@ -77,3 +77,4 @@ SPDX-License-Identifier: MPL-2.0
{% include 'footer.jinja2' %}

</div>
</html>

0 comments on commit 65f3400

Please sign in to comment.