使用springboot集成javaMail进行邮件发送时,在本地进行发送邮件失败,提示
Failed message 1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.163.com, 25; timeout -1;
解决方案:
将25端口改为465端口,并启用smtps协议
配置示例:
spring:
mail:
host: smtp.163.com
username: ******@163.com
password: ******
default-encoding: UTF-8
port: 465
protocol: smtps