mirror of
https://github.com/whyour/qinglong.git
synced 2026-03-29 19:11:02 +08:00
支持自定义接收邮箱地址
This commit is contained in:
parent
07bf0c705b
commit
9b47912952
|
|
@ -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/
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user