Merge pull request #244 from clover1420/dev
修复邮箱推送的编码错误,优化邮箱信息的由于背景图片而看不清文字。
This commit is contained in:
commit
f221ae7d58
@ -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>
|
||||
|
4
push.py
4
push.py
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user