SpringBoot 使用JavaMail发送邮件报错MailConnectException: Couldn't connect to host, port: smtp.qq.com, 465; timeout -1, 解决方式。

1.先上一个报错图片:

2.applicaiton.properties对应的设置:

#mail related
spring.mail.host=smtp.qq.com
spring.mail.port=465
spring.mail.protocol=smtp
spring.mail.username=XXX@qq.comXXX
spring.mail.password=*********
spring.mail.default-encoding=UTF-8spring.mail.properties.mail.smtp.socketFactory.port=465
spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
spring.mail.properties.mail.smtp.socketFactory.fallback=falsespring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.properties.mail.smtp.ssl.enable=true
spring.mail.properties.mail.smtp.ssl.trust=smtp.qq.comspring.mail.properties.mail.smtp.connectiontimeout=5000
spring.mail.properties.mail.smtp.timeout=3000
spring.mail.properties.mail.smtp.writetimeout=5000#sprint.mail.test-connection=true
#spring.mail.properties.mail.debug=true

3.问题排查:

使用telnet smtp.qq.com 465 命令在cmd窗口运行下:

说明公司网络不能够连接到smtp, 可能是公司限制的访问。连接自己的手机热点再试。问题解决。

4.另外使用qq邮箱时候需要设置;

具体参考:https://blog.csdn.net/binlixia/article/details/52768066

MailConnectException: Couldn‘t connect to host相关推荐

  1. com.sun.mail.util.MailConnectException: Couldn't connect to host异常解决

    最近在做一个接口项目,需要捕获所有的异常信息,并发送邮件给管理员.使用了JavaMail来实现,然后发现在本地(windows环境)上可以正常发送邮件,而放到了linux环境上就无法发送邮件.相关错误 ...

  2. Linux环境邮件服务报错:Couldn‘t connect to host, port: smtp.qq.com, 25; timeout -1;

    在Windows环境下邮件服务能够正常使用,但是在Linux环境下,邮件服务报错,无法发送邮件. 具体报错信息如下: com.sun.mail.util.MailConnectException: C ...

  3. ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote...

    ssh报错: ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remo ...

  4. Github拉取远端的时候提示“ssh: connect to host github.com port 22: Connection timed out”错误...

    在使用Github的时候,如果使用到拉取远端分支的时候或者测试ssh -T git@github.com的时候可能会出现连接失败的问题,错误描述为"ssh: connect to host ...

  5. Ubuntu下 ssh : connect to host localhost port 22:Connection refused

    Ubuntu下测试ssh时使用ssh localhost 命令,出现错误提示connect to host localhost port 22:Connection refused 造成这个错误的原因 ...

  6. curl: (7) couldn‘t connect to host 解决方法

    curl: (7) couldn't connect to host 解决方法 参考文章: (1)curl: (7) couldn't connect to host 解决方法 (2)https:// ...

  7. ssh连接服务器出现:ssh: connect to host 192.168.1.107 port 22: Connection refused 的解决方法

    文章目录: 1 说明遇到问题场景 2 解决方式 1 说明遇到问题场景 1.我的系统环境 windows10 连接的服务器系统为:Mint19.3 2.我使用windows,在局域网下通过ssh连接服务 ...

  8. mac connect to host localhost port 22: Connection refused

    在Mac OS X 10.10.5学习hadoop的过程中,输入命令ssh localhost得到 ssh: connect to host localhost port 22: Connection ...

  9. vmware中的Ubuntu安装ssh全家桶(解决connect to host localhost port 22: Connection refused)...

    2019独角兽企业重金招聘Python工程师标准>>> 网上查询过异常信息后得知系统需要安装ssh服务. 1.重现问题:ssh localhost 报错connect to host ...

最新文章

  1. 基于SSM实现医院疫情管理系统
  2. 十步优化SQL Server中的数据访问
  3. c语言均值滤波程序,10种简单的数字滤波算法(C语言源程序)
  4. 百度港股开盘持续下跌,网络营销外包下百度二次上市遇冷
  5. 利用ssh+rsync+inotify实现数据的异地实时同步
  6. Java实现算法导论中最近点对问题分治法
  7. sql 统计每月入职离职人数_入职登记表算合同吗?这里面有大学问
  8. android cpu绑核
  9. python变量类型怎么决定的_Python数据类型提示痛点的解决方案探讨
  10. 就业技术书文件表格_429页标准指南,教你如何管理工程监理文件资料,丰富图表一看就会...
  11. 天梯赛 L2-011. (二叉树) 玩转二叉树
  12. Opencl入门Demo
  13. 手机浏览器哪个好用,UC、多御和QQ浏览器对比
  14. 别没事就打开懂车帝了,我的字节跳动懂车帝三面面试经验
  15. 安卓camera2 API获取YUV420_888格式详解
  16. fairseq入门教程
  17. C#去除字符串中的换行符回车符空格符等
  18. The Untended Antiquity (二维树状数组 哈希)
  19. 自学html4,HTML4
  20. 一站式轻监控轻运维系统nezha(上篇)

热门文章

  1. 51CTO多功能双肩包【博客活动礼品】
  2. 玩转星际争霸局部战斗 —— QMIX
  3. cocos creater 使用.max文件/.max文件转换为.fbx文件
  4. Python图书管理系统(终章)
  5. 实验11-1-7 藏头诗 (15分)
  6. 24 个很酷的 Linux/Unix 工具
  7. 枚举方法在swtch中的用法
  8. (二)基于区块链的自动抽奖系统从0到1实现
  9. FOR 循环 珠峰折纸
  10. Linux 安装python 3.8(Linux 的版本为 Centos 7)