springboot 发送邮件
1.加入依赖
<!-- 邮件 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<!-- 邮件 -->
2.向application.properties中添加
######企业邮箱########
spring.mail.host=smtp.mxhichina.com
spring.mail.username=xxxx@begoit.com
spring.mail.password=xxx123456
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true