1.在服务端的pom文件中增加依赖
<!--邮件服务-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
2.在服务端的配置文件application.properties文件中对邮件进行配置
#邮箱服务
spring.mail.host=smtp.qq.com
#邮箱地址
[email protected]
#qq邮箱授权码,如果是其他邮箱一般为密码,具体看邮箱要求
spring.mail.password=----------------
# 设置是否需要认证,如果为true,那么用户名和密码就必须的,
#如果设置false,可以不设置用户名和密码,当然也得看你的对接的平台是否支持无密码进行访问的。
spring.mail.properties.mail.smtp.auth=true
#STARTTLS[1] 是对纯文本通信协议的扩展。它提供一种方式将纯文本连接升级为加密连接(TLS或SSL),而不是另外使用一个端口作加密通信
#服务器需要tls验证
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
# 发送给谁
[email protected]
# 是谁发送出去的
[email protected]
3.开启邮箱授权服务(qq邮箱)
http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256
4.应用服务上线线下邮件通知
扫描二维码关注公众号,回复:
5109211 查看本文章
- 上线通知
- 下线通知