✨ Improved email spam-score
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
|
# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MPL-2.0
|
# SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import smtplib
|
import smtplib
|
||||||
import ssl
|
import ssl
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
from email.utils import formatdate
|
||||||
|
|
||||||
from jinja2 import Environment, PackageLoader, select_autoescape
|
from jinja2 import Environment, PackageLoader, select_autoescape
|
||||||
|
|
||||||
@@ -28,6 +27,7 @@ def _sendMail(template: str, to: str, subject: str):
|
|||||||
msg["Subject"] = subject
|
msg["Subject"] = subject
|
||||||
msg["From"] = settings.mail_address
|
msg["From"] = settings.mail_address
|
||||||
msg["To"] = to
|
msg["To"] = to
|
||||||
|
msg["Date"] = formatdate(localtime=True)
|
||||||
msg.attach(MIMEText(template, "html"))
|
msg.attach(MIMEText(template, "html"))
|
||||||
context = ssl.SSLContext(ssl.PROTOCOL_TLS)
|
context = ssl.SSLContext(ssl.PROTOCOL_TLS)
|
||||||
server = smtplib.SMTP(host=settings.mail_server, port=settings.mail_port)
|
server = smtplib.SMTP(host=settings.mail_server, port=settings.mail_port)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
|
|||||||
|
|
||||||
SPDX-License-Identifier: MPL-2.0
|
SPDX-License-Identifier: MPL-2.0
|
||||||
-->
|
-->
|
||||||
|
<html>
|
||||||
<div style='box-sizing: border-box;display: block;max-width: 600px;margin: 0 auto;padding: 10px'><span
|
<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>
|
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'>
|
<div style='box-sizing: border-box;width: 100%;margin-bottom: 30px;margin-top: 15px'>
|
||||||
@@ -76,3 +77,4 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
{% include 'footer.jinja2' %}
|
{% include 'footer.jinja2' %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
|
|||||||
|
|
||||||
SPDX-License-Identifier: MPL-2.0
|
SPDX-License-Identifier: MPL-2.0
|
||||||
-->
|
-->
|
||||||
|
<html>
|
||||||
<div style='box-sizing: border-box;display: block;max-width: 600px;margin: 0 auto;padding: 10px'><span
|
<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>
|
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'>
|
<div style='box-sizing: border-box;width: 100%;margin-bottom: 30px;margin-top: 15px'>
|
||||||
@@ -77,3 +77,4 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
{% include 'footer.jinja2' %}
|
{% include 'footer.jinja2' %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user