diff --git a/wfc-common/wfc-common-mail/src/main/java/org/wfc/common/mail/config/properties/MailProperties.java b/wfc-common/wfc-common-mail/src/main/java/org/wfc/common/mail/config/properties/MailProperties.java index 18c7848..ea313db 100644 --- a/wfc-common/wfc-common-mail/src/main/java/org/wfc/common/mail/config/properties/MailProperties.java +++ b/wfc-common/wfc-common-mail/src/main/java/org/wfc/common/mail/config/properties/MailProperties.java @@ -66,4 +66,9 @@ public class MailProperties { * Socket连接超时值,单位毫秒,缺省值不超时 */ private Long connectionTimeout; + + /** + * 邮件标题 + */ + private String subject; } diff --git a/wfc-modules/wfc-system/src/main/java/org/wfc/system/controller/SysEmailController.java b/wfc-modules/wfc-system/src/main/java/org/wfc/system/controller/SysEmailController.java index d840012..93b8111 100644 --- a/wfc-modules/wfc-system/src/main/java/org/wfc/system/controller/SysEmailController.java +++ b/wfc-modules/wfc-system/src/main/java/org/wfc/system/controller/SysEmailController.java @@ -2,6 +2,7 @@ package org.wfc.system.controller; import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; @@ -56,7 +57,11 @@ public class SysEmailController extends BaseController { context.setVariable("verificationCode", code); context.setVariable("expirationTime", Constants.MAIL_CAPTCHA_EXPIRATION); String htmlStr = templateEngine.process("mail", context); - MailUtils.sendHtml(email, "Your WANFI verification code", htmlStr); + String subject = mailProperties.getSubject(); + if (StrUtil.isBlank(subject)) { + subject = "Your WANFI Verification Code"; + } + MailUtils.sendHtml(email, subject, htmlStr); } catch (Exception e) { log.error("email verification code send failed => {}", e.getMessage()); return R.fail(e.getMessage()); diff --git a/wfc-modules/wfc-system/src/main/resources/templates/mail.html b/wfc-modules/wfc-system/src/main/resources/templates/mail.html deleted file mode 100644 index 7d6e42f..0000000 --- a/wfc-modules/wfc-system/src/main/resources/templates/mail.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - 验证码邮件 - - - - - - - -
- - - - - - - - - - - - - - - - -
- 公司Logo -
-

您的验证码

-

- 请使用以下验证码完成操作: -

-
- -
- -

- 该验证码将在 分钟后失效,请及时使用 -

-
-

- 此为系统自动发送邮件,请勿直接回复
- 如有疑问请联系 support@example.com
- © 2023 您的公司名称。保留所有权利 -

-

- 退订邮件 -

-
- -
- - \ No newline at end of file diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UEmailController.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UEmailController.java index 94903c2..b47b1c4 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UEmailController.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/controller/UEmailController.java @@ -2,6 +2,7 @@ package org.wfc.user.controller; import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; @@ -56,7 +57,11 @@ public class UEmailController extends BaseController { context.setVariable("verificationCode", code); context.setVariable("expirationTime", Constants.MAIL_CAPTCHA_EXPIRATION); String htmlStr = templateEngine.process("mail", context); - MailUtils.sendHtml(email, "Your WANFI verification code", htmlStr); + String subject = mailProperties.getSubject(); + if (StrUtil.isBlank(subject)) { + subject = "Your WANFI Verification Code"; + } + MailUtils.sendHtml(email, subject, htmlStr); } catch (Exception e) { log.error("email verification code send failed => {}", e.getMessage()); return R.fail(e.getMessage()); diff --git a/wfc-modules/wfc-user/src/main/resources/templates/mail.html b/wfc-modules/wfc-user/src/main/resources/templates/mail.html deleted file mode 100644 index 7d6e42f..0000000 --- a/wfc-modules/wfc-user/src/main/resources/templates/mail.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - 验证码邮件 - - - - - - - -
- - - - - - - - - - - - - - - - -
- 公司Logo -
-

您的验证码

-

- 请使用以下验证码完成操作: -

-
- -
- -

- 该验证码将在 分钟后失效,请及时使用 -

-
-

- 此为系统自动发送邮件,请勿直接回复
- 如有疑问请联系 support@example.com
- © 2023 您的公司名称。保留所有权利 -

-

- 退订邮件 -

-
- -
- - \ No newline at end of file