[password-resets] Attach images rather than referencing them externally due to some mail clients blocking images/stati
- From: Andrea Veri <averi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [password-resets] Attach images rather than referencing them externally due to some mail clients blocking images/stati
- Date: Mon, 23 Nov 2020 11:43:20 +0000 (UTC)
commit 289fc295fd1b6b6afdbcd134369fe3af593426ce
Author: Andrea Veri <averi redhat com>
Date: Mon Nov 23 12:43:11 2020 +0100
Attach images rather than referencing them externally due to some mail clients blocking images/static
content coming from external websites
app.py | 5 +++++
templates/password_reset_mail.html | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/app.py b/app.py
index 1de4d81..c28e26b 100644
--- a/app.py
+++ b/app.py
@@ -135,6 +135,11 @@ def send_email(email, token):
msgRoot.add_related(image1, maintype='image',
subtype=imghdr.what(None, image1), cid='<image1>')
+ with open(f"{DOCUMENT_ROOT}/static/images/Mail-LockSymbol.jpg", 'rb') as _img2:
+ image2 = _img2.read()
+ msgRoot.add_related(image2, maintype='image',
+ subtype=imghdr.what(None, image2), cid='<image2>')
+
with smtplib.SMTP(f"{SMTP_RELAY_HOST}", 25) as server:
server.starttls()
server.sendmail(
diff --git a/templates/password_reset_mail.html b/templates/password_reset_mail.html
index e3a5e4b..b21576b 100644
--- a/templates/password_reset_mail.html
+++ b/templates/password_reset_mail.html
@@ -12,7 +12,7 @@
<table align="center" cellpadding="15px" cellspacing="0" width="600" style="border-collapse:
collapse;">
<tr style="border-left: 1px solid #4295DB;border-right: 1px solid #4295DB;">
<td bgcolor="#4295DB" style="padding: 20px;">
- <img src="/static/images/GNOME-LogoHorizontal-white.png"
+ <img src="cid:image1"
alt="GNOME Logo"
width="110px"
style="display: block;"
@@ -25,7 +25,7 @@
style="border-collapse: collapse;">
<tr>
<td bgcolor="white" align="center">
- <img src="/static/images/Mail-LockSymbol.jpg"
+ <img src="cid:image2"
alt="Locked Symbol"
width="100px"
/>
@@ -63,4 +63,4 @@
</tr>
</table>
</body>
-</html>
\ No newline at end of file
+</html>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]