Add MailerSend and template-based email verification
Introduced support for MailerSend as an email provider alongside SMTP, with configuration options in settings. Added Jinja2-based multi-language email templates for verification emails, and refactored the email sending logic to use these templates and support language selection based on user country code. Updated related services and API endpoints to pass country code and handle new response formats. Added dependencies for Jinja2 and MailerSend.
This commit is contained in:
141
app/templates/email/verification_zh.html
Normal file
141
app/templates/email/verification_zh.html
Normal file
@@ -0,0 +1,141 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>邮箱验证 - {{ server_name }}</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.header {
|
||||
background: linear-gradient(135deg, #ED8EA6 0%, #FF6B9D 100%);
|
||||
color: white;
|
||||
padding: 40px 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.header h1 {
|
||||
margin: 0;
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.header p {
|
||||
margin: 10px 0 0 0;
|
||||
font-size: 16px;
|
||||
opacity: 0.9;
|
||||
}
|
||||
.content {
|
||||
padding: 40px 30px;
|
||||
}
|
||||
.greeting {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.message {
|
||||
font-size: 15px;
|
||||
line-height: 1.6;
|
||||
color: #555;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.code-box {
|
||||
background: #f8f9fa;
|
||||
border: 2px solid #ED8EA6;
|
||||
border-radius: 12px;
|
||||
padding: 25px;
|
||||
text-align: center;
|
||||
margin: 30px 0;
|
||||
}
|
||||
.code {
|
||||
font-size: 36px;
|
||||
font-weight: bold;
|
||||
letter-spacing: 8px;
|
||||
color: #ED8EA6;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
.expiry {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-top: 15px;
|
||||
}
|
||||
.warning-box {
|
||||
background: #fff3cd;
|
||||
border-left: 4px solid #ffc107;
|
||||
border-radius: 6px;
|
||||
padding: 20px;
|
||||
margin: 30px 0;
|
||||
}
|
||||
.warning-box h3 {
|
||||
margin: 0 0 10px 0;
|
||||
font-size: 16px;
|
||||
color: #856404;
|
||||
}
|
||||
.warning-box ul {
|
||||
margin: 10px 0;
|
||||
padding-left: 20px;
|
||||
color: #856404;
|
||||
}
|
||||
.warning-box li {
|
||||
margin: 8px 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
.footer {
|
||||
background: #2c3e50;
|
||||
color: #ecf0f1;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
.footer p {
|
||||
margin: 5px 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>邮箱验证</h1>
|
||||
<p>Email Verification</p>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<div class="greeting">你好,{{ username }}!</div>
|
||||
|
||||
<div class="message">
|
||||
<p>感谢你注册 {{ server_name }}。为了完成账户验证,请使用以下验证码:</p>
|
||||
</div>
|
||||
|
||||
<div class="code-box">
|
||||
<div class="code">{{ code }}</div>
|
||||
<div class="expiry">⏱️ 验证码将在 <strong>{{ expiry_minutes }} 分钟</strong>内有效</div>
|
||||
</div>
|
||||
|
||||
<div class="warning-box">
|
||||
<h3>安全提示</h3>
|
||||
<ul>
|
||||
<li>请不要与任何人分享此验证码</li>
|
||||
<li>如果您没有请求此验证码,请忽略这封邮件</li>
|
||||
<li>为了账户安全,请勿在其他网站使用相同的密码</li>
|
||||
<li>验证码仅能使用一次</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<p>© {{ year }} {{ server_name }}. 保留所有权利。</p>
|
||||
<p>此邮件由系统自动发送,请勿回复。</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user