\n" +
+ "
尊敬的用户:
\n" +
+ "
\n" +
+ "您正在乖乖狼科技旗下软件产品进行操作,您的验证码为\n" +
+ ""+code+"\n" +
+ ",有效期为十分钟,请及时填写验证码。\n" +
+ "
\n" +
+ "
如果这不是您本人操作,请忽略此邮件
\n" +
+ "
乖乖狼科技
\n" +
+ "
";
+
+ return sendEmail(to,title,context);
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/guaiguailang/harmony/utils/VerificationCodeGenerator.java b/src/main/java/com/guaiguailang/harmony/utils/VerificationCodeGenerator.java
new file mode 100644
index 0000000..c0496ed
--- /dev/null
+++ b/src/main/java/com/guaiguailang/harmony/utils/VerificationCodeGenerator.java
@@ -0,0 +1,27 @@
+package com.guaiguailang.harmony.utils;
+
+import java.util.Random;
+
+public class VerificationCodeGenerator {
+
+ public static void main(String[] args) {
+ String verificationCode = generateFourDigitCode();
+ System.out.println("Generated Verification Code: " + verificationCode);
+ }
+
+ /**
+ * 生成一个四位数的验证码
+ * @return 四位数的验证码字符串
+ */
+ public static String generateFourDigitCode() {
+ Random random = new Random();
+ StringBuilder code = new StringBuilder(4);
+
+ for (int i = 0; i < 4; i++) {
+ int digit = random.nextInt(10); // 生成一个0到9之间的随机整数
+ code.append(digit);
+ }
+
+ return code.toString();
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index f1271e9..bc4be5e 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -67,3 +67,44 @@ sa-token.token-style=uuid
# 是否输出操作日志
sa-token.is-log=true
+
+#application.properties基本配置,后面我都使用此配置来发送邮件
+## 基本配置
+### smtp服务器主机(163的)
+spring.mail.host=smtp.qiye.163.com
+spring.mail.port=25
+### 服务协议SMTP(代表是发送邮件)
+spring.mail.protocol=smtp
+### 登录服务器邮箱账号
+spring.mail.username=news@mllt.cc
+### 登录服务器邮箱授权码(不是邮箱密码,这个是我们开通SMTP、POP时得到的授权码)
+spring.mail.password=Qq2686485465@
+### 默认邮件的编码集(MimeMessage 编码,默认UTF-8)
+spring.mail.default-encoding=UTF-8
+
+# 补充配置(这里具体可以参照Jakarta Mail的扩展配置)
+## 默认发送方邮箱账号(当程序未指定发件人邮箱则默认取这个)
+spring.mail.properties.mail.smtp.from=news@mllt.cc
+## 开启权限认证
+spring.mail.properties.mail.smtp.auth=true
+## 邮件接收时间的限制
+spring.mail.properties.mail.smtp.timeout=60000
+## 连接时间的限制
+spring.mail.properties.mail.smtp.connectiontimeout=60000
+## 邮件发送时间的限制(毫秒)
+spring.mail.properties.mail.smtp.writetimeout=60000
+## 日志打印,邮件发送过程的日志会被输出
+spring.mail.properties.mail.debug=true
+# 下面这条配置请去 src/main/java/com/guaiguailang/harmony/config/MailConfig.java 修改。在这里修改是无效的。因为这里写中文会导致乱码。
+email.form.nickname=[和生]消息通知
+
+
+
+
+# 中文乱码问题
+banner.charset=UTF-8
+server.tomcat.uri-encoding=UTF-8
+server.servlet.encoding.charset=UTF-8
+server.servlet.encoding.enabled=true
+server.servlet.encoding.force=true
+spring.messages.encoding=UTF-8
\ No newline at end of file
diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml
index f4c88e6..8b7a2ab 100644
--- a/src/main/resources/mapper/UserMapper.xml
+++ b/src/main/resources/mapper/UserMapper.xml
@@ -14,6 +14,11 @@