From 9b479129522460ae652fd3ad79106447b964660f Mon Sep 17 00:00:00 2001 From: huelse Date: Wed, 18 Mar 2026 17:20:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E9=82=AE=E7=AE=B1=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/config.sample.sh | 2 ++ sample/notify.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sample/config.sample.sh b/sample/config.sample.sh index 734f4ae5..4627fdb5 100644 --- a/sample/config.sample.sh +++ b/sample/config.sample.sh @@ -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/ diff --git a/sample/notify.py b/sample/notify.py index 8dd885ca..e7eb031f 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -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()