diff --git a/test/pom.xml b/test/pom.xml index 6e5f300..5500f06 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -16,6 +16,10 @@ com.hxuanyu notify-spring-boot-starter + + com.hxuanyu + common-spring-boot-starter + org.springframework.boot spring-boot-starter-web diff --git a/test/src/main/java/com/hxuanyu/test/MainApplication.java b/test/src/main/java/com/hxuanyu/test/MainApplication.java new file mode 100644 index 0000000..545499e --- /dev/null +++ b/test/src/main/java/com/hxuanyu/test/MainApplication.java @@ -0,0 +1,17 @@ +package com.hxuanyu.test; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * TODO + * + * @author hanxuanyu + * @version 1.0 + */ +@SpringBootApplication +public class MainApplication { + public static void main(String[] args) { + SpringApplication.run(MainApplication.class, args); + } +} diff --git a/test/src/main/java/com/hxuanyu/test/controller/TestController.java b/test/src/main/java/com/hxuanyu/test/controller/TestController.java new file mode 100644 index 0000000..2aa781b --- /dev/null +++ b/test/src/main/java/com/hxuanyu/test/controller/TestController.java @@ -0,0 +1,44 @@ +package com.hxuanyu.test.controller; + +import com.hxuanyu.common.message.Msg; +import com.hxuanyu.notify.model.Mail; +import com.hxuanyu.notify.service.MailService; +import com.hxuanyu.notify.service.NotifyService; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.Mapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * 测试控制器 + * + * @author hanxuanyu + * @version 1.0 + */ + +@RestController +public class TestController { + + + @Resource + MailService mailService; + + @RequestMapping("/testMail") + public Msg testMail(){ + Mail mail = new Mail(); + mail.setContent("邮件内容"); + mail.setSubject("邮件主题"); + mail.setTo("2252193204@qq.com"); + + try { + mailService.sendMail(mail); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + return Msg.success("发送邮件成功", mail); + } +} diff --git a/test/src/main/resources/templates/mail/mail.html b/test/src/main/resources/templates/mail/mail.html new file mode 100644 index 0000000..0cb7677 --- /dev/null +++ b/test/src/main/resources/templates/mail/mail.html @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + ${title} + + + + + + + + + + + + 注意本邮件由系统自动发送,请勿回复本邮件,如果邮件内容您并不知情,请忽略本邮件 + + + + + + + + + \ No newline at end of file