当前位置:网站首页>Alicloud: could not connect to SMTP host: SMTP 163.com, port: 25
Alicloud: could not connect to SMTP host: SMTP 163.com, port: 25
2022-04-23 20:13:00 【My brother is not strong enough to fight】
Problem description :
I wrote a monitoring program myself , adopt javamail Send monitoring information , When deployed to service execution, an error is reported :
javax.mail.MessagingException: Could not connect to SMTP host: smtp.163.com, port: 25;
DEBUG SMTP: trying to connect to host "smtp.163.com", port 25, isSSL false
javax.mail.MessagingException: Could not connect to SMTP host: smtp.163.com, port: 25;
nested exception is:
java.net.ConnectException: Connection timed out (Connection timed out)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1961)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:196)
at com.sonkwo.bi.quartz.util.EmailUtils.sendEmail(EmailUtils.java:108)
at com.sonkwo.bi.quartz.task.RyTask.toSendCheckSyncData(RyTask.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
mean : The server could not pass host: smtp.163.com, port: 25 Connect
By hand telnet verification , Really can't connect
telnet smtp.163.com 25
Trying 220.181.15.161...
There are two solutions :
- Unseal 25 Port no. ( Not recommended );
- Use other ports (465 Port no. , recommend ).
I remind of it , Doing it azkaban I encountered this problem when sending email notification , Finally, by recompiling azkaban Source code , Only then 25 Port changed to 465 port , Specific view :【(21 Bar message ) Azkaban recompile , solve :Could not connect to SMTP host: smtp.163.com, port: 465【2022 year 01 month 10 Japan 】_ The blog of brother Xiaoqiang who can't die -CSDN Blog 】
Final solution :
modify javamail Port number in , Add the following code :
// PS: Some mailbox servers require SMTP Connection needs to use SSL Safety certification ( To improve safety , Mailbox support SSL Connect , You can open it yourself ),
// If you can't connect to the mail server , Check the console print carefully log, If there is something similar “ The connection fails , requirement SSL A secure connection ” Such mistakes ,
// Open up below /* ... */ Comment code between , Turn on SSL A secure connection .
/*
// SMTP The port of the server ( Not SSL The port of the connection is usually... By default 25, Can not add , If it's on SSL Connect ,
// It needs to be changed to SMTP The port of the server , For details, please refer to the help of the corresponding mailbox service ,
// QQ Mailbox SMTP(SLL) Port is 465 or 587, Check other mailboxes by yourself )
final String smtpPort = "465";
props.setProperty("mail.smtp.port", smtpPort);
props.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.setProperty("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.socketFactory.port", smtpPort);
The problem is finally solved , The mail went off smoothly ...
ps: If you want to get javamail Source code , Please see 【(21 Bar message ) adopt javaMail Send E-mail _ The blog of brother Xiaoqiang who can't die -CSDN Blog 】
版权声明
本文为[My brother is not strong enough to fight]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210556213720.html
边栏推荐
- How does onlyoffice solve no route to host
- NC basic usage 1
- 【数值预测案例】(3) LSTM 时间序列电量预测,附Tensorflow完整代码
- The textarea cursor cannot be controlled by the keyboard due to antd dropdown + modal + textarea
- A simple (redisson based) distributed synchronization tool class encapsulation
- Video understanding
- Unity创建超写实三维场景的一般步骤
- nc基础用法4
- Electron入门教程4 —— 切换应用的主题
- Scrum Patterns之理解各种团队模式
猜你喜欢
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(五)
SIGIR'22「微软」CTR估计:利用上下文信息促进特征表征学习
Understanding various team patterns in scrum patterns
Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies
[target tracking] pedestrian attitude recognition based on frame difference method combined with Kalman filter, with matlab code
PCL点云处理之计算两平面交线(五十一)
Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies
Notes of Tang Shu's grammar class in postgraduate entrance examination English
[webrtc] add x264 encoder for CEF / Chromium
Mysql database backup scheme
随机推荐
[H264] hevc H264 parsing and frame rate setting of the old version of libvlc
波场DAO新物种下场,USDD如何破局稳定币市场?
Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies
如何做产品创新?——产品创新方法论探索一
filebeat、logstash配置安装
Record: call mapper to report null pointer Foreach > the usage of not removing repetition;
Why is the hexadecimal printf output of C language sometimes with 0xff and sometimes not
Unity general steps for creating a hyper realistic 3D scene
Remote code execution in Win 11 using wpad / PAC and JScript
MySQL数据库 - 单表查询(三)
还在用 ListView?使用 AnimatedList 让列表元素动起来
Kubernetes entry to mastery - bare metal loadbalance 80 443 port exposure precautions
【文本分类案例】(4) RNN、LSTM 电影评价倾向分类,附TensorFlow完整代码
Wave field Dao new species end up, how does usdd break the situation and stabilize the currency market?
渤海期货这家公司怎么样。期货开户办理安全?
Cadence Orcad Capture CIS更换元器件之Link Database 功能介绍图文教程及视频演示
Scrum Patterns之理解各种团队模式
程序设计语言基础(2)
NC basic usage 4
Video understanding