之前用javamaill的方式发送邮件,比较繁琐,现在利用spring-mail来发送邮件,非常简单
1.引入pom依赖,分别是freemarker邮件模板和spring-maill依赖
<!-- Spring Boot Freemarker 依赖,发送HTML格式的邮件的方式 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<!-- spring-boot-mail 发送邮箱 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
2.加入配置在application.properties
#模板加载路径
spring.freemarker.template-loader-path=classpath:/static/template/
#模板文件后缀
spring.freemarker.suffix=.flt
spring.freemarker.enabled=true
spring.freemarker.cache=false
spring.f