This commit is contained in:
huangzhenpc
2025-03-05 11:11:41 +08:00
parent 6c2fa866f9
commit 8855475bbb

View File

@@ -54,14 +54,23 @@ def create_app():
@app.route('/web/list') @app.route('/web/list')
def list_emails_page(): def list_emails_page():
emails = get_latest_emails(count=50) try:
return render_template('email_list.html', emails=emails) # 不指定 recipient获取所有邮件
emails = get_latest_emails(recipient=None, count=50)
return render_template('email_list.html', emails=emails)
except Exception as e:
app.logger.error(f"Error in list_emails_page: {str(e)}")
return "获取邮件列表失败", 500
@app.route('/email/<recipient>') @app.route('/web/email/<recipient>')
def view_email_page(recipient): def view_email_page(recipient):
email = get_latest_email_with_code(recipient) try:
if email: email = get_latest_email_with_code(recipient)
return render_template('email_detail.html', email=email) if email:
return "邮件不存在", 404 return render_template('email_detail.html', email=email)
return "邮件不存在", 404
except Exception as e:
app.logger.error(f"Error in view_email_page: {str(e)}")
return "获取邮件详情失败", 500
return app return app