Skip to content

feat:新增邮件推送,仅支持qq(已测试),163(未测试)#288

Open
iceNo9 wants to merge 5 commits into
cc004:mainfrom
iceNo9:main
Open

feat:新增邮件推送,仅支持qq(已测试),163(未测试)#288
iceNo9 wants to merge 5 commits into
cc004:mainfrom
iceNo9:main

Conversation

@iceNo9
Copy link
Copy Markdown

@iceNo9 iceNo9 commented Mar 16, 2026

需要提前设置环境变量
MAIL_FROM 发信人
MAIL_PASSWORD 授权码
MAIL_TO 收信人

Comment thread autopcr/util/notify.py
missing.append('MAIL_TO')

if missing:
raise ValueError(f"缺少必要的环境变量: {', '.join(missing)}")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没设置的话这个raise貌似会直接抛到更外层才会捕获,可以弄个类似enable选项来控制下面的send函数是否执行

res = await self.save_daily_result(resp, status)
# 新增邮件通知
img = await drawer.draw_tasks_result(res.get_result())
notifyer = MailNotifier()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议是这个类弄成单例的,不用每次new一个

# 新增邮件通知
img = await drawer.draw_tasks_result(res.get_result())
notifyer = MailNotifier()
notifyer.send_html_with_image(img)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个最好提到Account类的do_daily,然后配合帐号配置项(可能得给前端增加选项,或者用module功能的配置)来选择是否启用邮件发送

@Lanly109
Copy link
Copy Markdown
Collaborator

Lanly109 commented May 6, 2026

好像引入了不相关的提交,请重新提pr吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants