Merge pull request #244 from clover1420/dev

修复邮箱推送的编码错误,优化邮箱信息的由于背景图片而看不清文字。
This commit is contained in:
Womsxd 2022-09-03 12:35:13 +08:00 committed by GitHub
commit f221ae7d58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -12,14 +12,15 @@
<div class="cover">
<!-- 邮箱只解析行内样式 -->
<img src="https://iw233.cn/api/Random.php" alt="background" style="width: 100%;
filter: brightness(80%)">
filter: brightness(50%)">
<section style="position: fixed; width: 100%;
top: 10%;
left: 0;
text-align: center;
font-weight: 800;">
<h2>{title}</h2>
<p>{message}</p>
top: 10%;
left: 0;
text-align: center;
font-weight: 800;">
<!-- 添加阴影防止背景太鲜艳看不清文字 -->
<h2 style="color: #fff;text-shadow:0px 0px 10px #000;">{title}</h2>
<p style="color: #fff;text-shadow:0px 0px 10px #000;">{message}</p>
</section>
</div>
</body>

View File

@ -81,7 +81,7 @@ def cqhttp(send_title, push_message):
def smtp(send_title, push_message):
import smtplib
from email.mime.text import MIMEText
with open("assets/email_example.html") as f:
with open("assets/email_example.html", encoding="utf-8") as f:
EMAIL_TEMPLATE = f.read()
message = EMAIL_TEMPLATE.format(title=send_title, message=push_message.replace("\n", "<br/>"))
message = MIMEText(message, "html", "utf-8")
@ -199,7 +199,7 @@ def push(status, push_message):
func(title(status), push_message)
else:
func('「米游社脚本」config可能需要手动更新',
f'如果您多次收到此消息开头的推送证明您运行的环境无法自动更新config请手动更新一下谢谢\r\n{title(status)}\r\n{push_message}')
f'如果您多次收到此消息开头的推送证明您运行的环境无法自动更新config请手动更新一下谢谢\r\n{title(status)}\r\n{push_message}')
except Exception as r:
log.warning(f"推送执行错误:{str(r)}")
return 0