feat(email): 实现邮件模板系统并添加邮件发送功能

- 新增 EmailTemplateUtil 工具类,用于管理邮件模板和发送逻辑
- 在 MainController 中集成 EmailTemplateUtil,用于发送注册成功邮件
- 添加密码重置和通用通知邮件模板
- 实现邮件发送的降级机制,HTML邮件发送失败时自动发送文本邮件
- 添加邮件模板配置和发送设置配置
- 提供异步发送和模板缓存优化建议
This commit is contained in:
2025-08-28 21:02:47 +08:00
parent 557c18cae8
commit 22079719f0
8 changed files with 1429 additions and 11 deletions

View File

@@ -0,0 +1,260 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebSoft通知</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
line-height: 1.6;
color: #333;
background-color: #f5f5f5;
}
.email-container {
max-width: 600px;
margin: 0 auto;
background-color: #ffffff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.header {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
padding: 40px 30px;
text-align: center;
color: white;
}
.logo {
font-size: 32px;
font-weight: bold;
margin-bottom: 10px;
letter-spacing: 2px;
}
.header-subtitle {
font-size: 16px;
opacity: 0.9;
margin-bottom: 20px;
}
.notification-icon {
width: 60px;
height: 60px;
background-color: #00d2ff;
border-radius: 50%;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: center;
font-size: 30px;
}
.content {
padding: 40px 30px;
}
.title {
font-size: 24px;
color: #333;
margin-bottom: 20px;
text-align: center;
}
.message {
font-size: 16px;
color: #666;
margin-bottom: 30px;
line-height: 1.8;
}
.notification-content {
background-color: #f8f9fa;
border-radius: 8px;
padding: 25px;
margin: 30px 0;
border-left: 4px solid #4facfe;
}
.notification-content h3 {
color: #333;
margin-bottom: 15px;
font-size: 18px;
}
.notification-body {
color: #555;
line-height: 1.8;
}
.cta-section {
text-align: center;
margin: 40px 0;
}
.cta-button {
display: inline-block;
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
color: white;
text-decoration: none;
padding: 15px 40px;
border-radius: 25px;
font-size: 16px;
font-weight: 600;
transition: transform 0.2s ease;
box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}
.cta-button:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
}
.info-box {
background-color: #e3f2fd;
border: 1px solid #bbdefb;
border-radius: 6px;
padding: 15px;
margin: 20px 0;
color: #1565c0;
}
.info-box strong {
color: #0d47a1;
}
.footer {
background-color: #2c3e50;
color: #ecf0f1;
padding: 30px;
text-align: center;
}
.footer-content {
margin-bottom: 20px;
}
.footer-links {
margin: 20px 0;
}
.footer-links a {
color: #3498db;
text-decoration: none;
margin: 0 15px;
font-size: 14px;
}
.footer-links a:hover {
text-decoration: underline;
}
.copyright {
font-size: 12px;
color: #95a5a6;
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid #34495e;
}
.timestamp {
text-align: right;
font-size: 12px;
color: #999;
margin-top: 20px;
padding-top: 15px;
border-top: 1px solid #eee;
}
@media (max-width: 600px) {
.email-container {
margin: 0;
box-shadow: none;
}
.header, .content, .footer {
padding: 20px;
}
.logo {
font-size: 24px;
}
.title {
font-size: 20px;
}
}
</style>
</head>
<body>
<div class="email-container">
<!-- Header -->
<div class="header">
<div class="logo">WebSoft</div>
<div class="header-subtitle">企业级数字化解决方案</div>
<div class="notification-icon">📢</div>
</div>
<!-- Content -->
<div class="content">
<h1 class="title">${title!'系统通知'}</h1>
<p class="message">
${greeting!'您好!'}我们有一条重要通知需要告知您,请查看以下详细信息。
</p>
<!-- Notification Content -->
<div class="notification-content">
<h3>📋 通知详情</h3>
<div class="notification-body">
${content!'这是一条系统通知消息。'}
</div>
</div>
<!-- Info Box -->
<% if(infoMessage!) { %>
<div class="info-box">
<strong> 温馨提示:</strong> ${infoMessage!}
</div>
<% } %>
<!-- CTA Button -->
<% if(actionUrl!) { %>
<div class="cta-section">
<a href="${actionUrl!}" class="cta-button">${actionText!'查看详情'}</a>
</div>
<% } %>
<!-- Timestamp -->
<div class="timestamp">
发送时间:${sendTime!}
</div>
</div>
<!-- Footer -->
<div class="footer">
<div class="footer-content">
<strong>南宁网宿信息科技有限公司</strong><br>
专业的企业数字化转型服务商
</div>
<div class="footer-links">
<a href="https://www.gxwebsoft.com">官方网站</a>
<a href="https://www.gxwebsoft.com/help">帮助中心</a>
<a href="https://www.gxwebsoft.com/contact">联系我们</a>
</div>
<div class="copyright">
© 2024 南宁网宿信息科技有限公司 版权所有<br>
如有疑问请联系客服170083662@qq.com
</div>
</div>
</div>
</body>
</html>