QQ 邮箱 587 端口连接失败

262 天前
 XuYijie

springboot 项目,465 端口是正常发送,587 连接失败,是腾讯的问题还是我配置项里面少配置了什么东西呀。 报错:Could not connect to SMTP host: smtp.qq.com, port: 587 配置文件: #邮件服务器 spring.mail.host=smtp.qq.com spring.mail.port=587 spring.mail.username= spring.mail.password= spring.mail.protocol=smtp spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.ssl.enable=true spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.socketFactory.port=587 spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory

1741 次点击
所在节点    程序员
10 条回复
liyvhg
262 天前
2 个端口加密方式不同,587 端口是 STARTTLS 协议的,465 端口是为 SMTPS ( SMTP-over-SSL )
julyclyde
262 天前
@liyvhg 看错误信息,明显不是协议区别的问题

就是网络策略给限制了
busier
262 天前
前些时也做过类似开发 用的 163 邮箱 限制要宽松些 你可以先考虑开发用 回头正式用在换
yinmin
262 天前
587 端口是 starttls ,不是 smtp over ssl ,你改成 spring.mail.properties.mail.smtp.ssl.enable=false 再试试
yinmin
262 天前
或者去掉这 2 行,再试试

spring.mail.properties.mail.smtp.ssl.enable=true
spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
kkk9
262 天前
Could not connect to SMTP host: smtp.qq.com, port: 587

先检查 587 端口的出站方向流量是否正常放行
yinmin
262 天前
在 springboot 的机器上运行这条命令,检查是否能连通 smtp.qq.com:587 ,有些云服务商是封禁 25 、587 端口的
nc -vz smtp.qq.com 587

如果能连通,参考#4 、#5 。

这个问题其实 AI 能给出答案,我试了 GPT-4o 、Gemini 1.5 Pro 、Claude-3-Opus 、Mistral-Large 、Qwen-1.5-110B 、Yi-Large-turbo 都给出了正确解决方案。
XuYijie
260 天前
去掉 ssl.enable=true 这一行可以了,棒的哈哈哈
XuYijie
260 天前
@liyvhg 去掉 ssl.enable=true 这一行可以了,棒的哈哈哈
XuYijie
260 天前
@yinmin 去掉 ssl.enable=true 这一行可以了,棒的哈哈哈

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://tanronggui.xyz/t/1041600

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX