我的配置如下
spring:
#邮件配置
mail:
# 开启邮箱POP3/SMTP服务,获取客户端授权码(注意并不是邮箱密码,而是授权码)
password: rgzbmhkaunutdess
# 邮箱的用户名
username: 123@qq.com
# 设置邮箱主机
host: smtp.qq.com
# 服务协议
protocol: smtp
# 编码集
default-encoding: UTF-8
# 服务端口
port: 587
# 设置开启ssl
properties:
mail:
stmp:
ssl:
enable: true
无论我使用 smtp 协议的 587 端口还是 smtps 协议的 465 端口,发送邮件时都会报如下错误
org.springframework.mail.MailSendException: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: mail.host.com, 25; timeout -1;
求解,如解决,必采纳。