From 280224e6464e11692babec14c9ac6cd76f9da896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Fri, 7 Aug 2026 15:27:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(email):=20=E4=BC=98=E5=8C=96=E9=82=AE?= =?UTF-8?q?=E7=AE=B1=E9=AA=8C=E8=AF=81=E7=A0=81=E9=82=AE=E4=BB=B6=E5=8F=91?= =?UTF-8?q?=E9=80=81=E5=92=8C=E6=9B=B4=E6=96=B0=E9=80=9A=E7=9F=A5=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 邮箱验证码邮件标题直接带验证码,方便通知预览和邮件列表查看 - 优先发送HTML格式邮件,失败时降级为文本邮件发送 - 更新通知邮件模板视觉样式,提升阅读体验和品牌感知 - 优化密码重置邮件模板布局和内容结构,增加安全提示和帮助链接 - 改进注册成功邮件模板样式,增强信息分区和用户指导 - 所有邮件模板统一字体和颜色风格,提高整体视觉一致性 - 为通知、密码重置和注册成功页面添加响应式样式支持手机端显示 --- .../common/system/util/EmailTemplateUtil.java | 16 +- src/main/resources/templates/captcha.html | 219 ++++++++ .../resources/templates/notification.html | 372 ++++++------ .../resources/templates/password-reset.html | 503 ++++++++--------- .../resources/templates/register-success.html | 529 ++++++++---------- 5 files changed, 865 insertions(+), 774 deletions(-) create mode 100644 src/main/resources/templates/captcha.html diff --git a/src/main/java/com/gxwebsoft/common/system/util/EmailTemplateUtil.java b/src/main/java/com/gxwebsoft/common/system/util/EmailTemplateUtil.java index f442cc4..10957e3 100644 --- a/src/main/java/com/gxwebsoft/common/system/util/EmailTemplateUtil.java +++ b/src/main/java/com/gxwebsoft/common/system/util/EmailTemplateUtil.java @@ -208,8 +208,18 @@ public class EmailTemplateUtil { if (email == null || email.trim().isEmpty()) { return; } - String title = "邮箱验证码"; - String content = "您正在绑定或修改邮箱,验证码为:" + code + ",5 分钟内有效,请勿泄露给他人。如非本人操作,请忽略此邮件。"; - sendNotificationEmail(title, content, email, tenantId, "尊敬的用户", "验证码用于确认邮箱真实性,请勿转发给他人。", null, null); + // 标题直接带上验证码,手机通知预览/邮件列表一眼可见 + String title = "【WebSoft】邮箱验证码:" + code; + try { + Map data = new HashMap<>(); + data.put("code", code); + data.put("sendTime", DateUtil.now()); + + emailRecordService.sendHtmlEmail(title, "captcha.html", data, new String[]{email}); + } catch (Exception e) { + // 如果HTML邮件发送失败,降级为文本邮件(标题仍含验证码) + String content = "【WebSoft】邮箱验证码\r\n\r\n您的验证码:" + code + "\r\n\r\n5 分钟内有效,请勿泄露给他人。如非本人操作,请忽略此邮件。"; + emailRecordService.sendEmail(title, content, email, tenantId); + } } } diff --git a/src/main/resources/templates/captcha.html b/src/main/resources/templates/captcha.html new file mode 100644 index 0000000..137002d --- /dev/null +++ b/src/main/resources/templates/captcha.html @@ -0,0 +1,219 @@ + + + + + + WebSoft 邮箱验证码 + + + +
+
+ +
+ +
+ + +

邮箱验证码

+

您正在绑定或修改邮箱,请使用下方验证码完成验证。

+ + +
+
您的验证码
+
${code!}
+
⏱ 5 分钟内有效,请尽快使用
+
+ + +
+
验证码用于确认邮箱真实性
+
+ 请将验证码输入到注册或修改邮箱页面以完成操作。验证码仅对当前请求有效,过期后请重新获取。 +
+
+ + +
+
安全提示
+
+ • 验证码请勿转发或告诉他人,WebSoft 工作人员不会向您索取。
+ • 如非本人操作,请忽略此邮件,您的账号仍然安全。
+ • 多次未收到验证码可在客户端重新申请。 +
+
+ + +
+ 发送时间:${sendTime!} +
+ + + +
+
+ + diff --git a/src/main/resources/templates/notification.html b/src/main/resources/templates/notification.html index affb1d4..88de0e3 100644 --- a/src/main/resources/templates/notification.html +++ b/src/main/resources/templates/notification.html @@ -3,257 +3,209 @@ - WebSoft通知 + WebSoft - 系统通知 -
- -
- -
企业级数字化解决方案
-
📢
+
+
+
+
- -
-

${title!'系统通知'}

-

- ${greeting!'您好!'}我们有一条重要通知需要告知您,请查看以下详细信息。 -

+

${title!'系统通知'}

+

${greeting!'您好!'}我们有一条重要通知需要告知您,请查看以下详细信息。

- -
-

📋 通知详情

-
- ${content!'这是一条系统通知消息。'} -
-
- - - <% if(has(infoMessage)) { %> -
- ℹ️ 温馨提示: ${infoMessage!} -
- <% } %> - - - <% if(has(actionUrl)) { %> - - <% } %> - - -
- 发送时间:${sendTime!} -
+ +
+
通知详情
+
${content!'这是一条系统通知消息。'}
- + + <% if(has(infoMessage)) { %> +
+
温馨提示
+
    +
  • ${infoMessage!}
  • +
+
+ <% } %> + + + <% if(has(actionUrl)) { %> + +
如按钮未生效,请将上面的链接复制到浏览器打开。
+ <% } %> + + +
发送时间:${sendTime!}
+
+
diff --git a/src/main/resources/templates/password-reset.html b/src/main/resources/templates/password-reset.html index 5d13a39..a83d743 100644 --- a/src/main/resources/templates/password-reset.html +++ b/src/main/resources/templates/password-reset.html @@ -3,320 +3,287 @@ - WebSoft密码重置 + WebSoft - 密码重置 -