目录
1、在pom.xml添加如下依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency>
2、在application.yml中添加如下配置
mail: host: smtp.exmail.qq.com port: 465 username: xx@xxxx.com #初始邮件地址(发送邮件者) password: 123xx456 #密码 protocol: smtp properties: mail: smtp: auth: true ssl: enable: true socketFactory: class: com.sun.mail.util.MailSSLSocketFactory fallback: false