初始提交

This commit is contained in:
huangzhenpc
2025-03-05 10:42:37 +08:00
parent 14c7e6d7f9
commit ce5785c481
9 changed files with 545 additions and 0 deletions

28
app/init.py Normal file
View File

@@ -0,0 +1,28 @@
from flask import Flask, request, jsonify, render_template
from .utils import get_latest_emails, get_latest_email_with_code, add_allowed_domain, remove_allowed_domain, get_allowed_domains, get_allowed_domains_with_time
import redis
from .config import Config
from .smtp_server import start_smtp_server
import threading
def create_app():
app = Flask(__name__)
app.config.from_object(Config)
# 现有的路由保持不变...
@app.route('/')
def list_emails():
# 获取所有邮件
emails = get_latest_emails(count=50) # 获取最新50封邮件
return render_template('email_list.html', emails=emails)
@app.route('/email/<email_id>')
def view_email(email_id):
# 获取单个邮件详情
email = get_latest_email_with_code(email_id)
if email:
return render_template('email_detail.html', email=email)
return "邮件不存在", 404
return app