This commit is contained in:
Max 2026-03-18 17:25:45 +08:00 committed by GitHub
commit a3d4183106
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -201,6 +201,8 @@ export SMTP_EMAIL=""
export SMTP_PASSWORD=""
## smtp_name 填写 SMTP 收发件人姓名,可随意填写
export SMTP_NAME=""
## smtp_email_to 填写 SMTP 收件邮箱,可选
export SMTP_EMAIL_TO=""
## 17. PushMe
## 官方说明文档https://push.i-i.me/

View File

@ -108,6 +108,7 @@ push_config = {
'SMTP_SERVER': '', # SMTP 发送邮件服务器,形如 smtp.exmail.qq.com:465
'SMTP_SSL': 'false', # SMTP 发送邮件服务器是否使用 SSL填写 true 或 false
'SMTP_EMAIL': '', # SMTP 收发件邮箱,通知将会由自己发给自己
'SMTP_EMAIL_TO': '', # SMTP 收件邮箱,填了则会发送到这个邮箱
'SMTP_PASSWORD': '', # SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定
'SMTP_NAME': '', # SMTP 收发件人姓名,可随意填写
@ -690,6 +691,7 @@ def smtp(title: str, content: str) -> None:
return
print("SMTP 邮件 服务启动")
email_to = push_config.get("SMTP_EMAIL_TO") or push_config.get("SMTP_EMAIL")
message = MIMEText(content, "plain", "utf-8")
message["From"] = formataddr(
(
@ -700,7 +702,7 @@ def smtp(title: str, content: str) -> None:
message["To"] = formataddr(
(
Header(push_config.get("SMTP_NAME"), "utf-8").encode(),
push_config.get("SMTP_EMAIL"),
email_to,
)
)
message["Subject"] = Header(title, "utf-8")
@ -716,7 +718,7 @@ def smtp(title: str, content: str) -> None:
)
smtp_server.sendmail(
push_config.get("SMTP_EMAIL"),
push_config.get("SMTP_EMAIL"),
email_to,
message.as_bytes(),
)
smtp_server.close()