当前位置:网站首页>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
边栏推荐
- Lpc1768 optimization comparison of delay time and different levels
- NC basic usage 2
- MySQL 进阶 锁 -- MySQL锁概述、MySQL锁的分类:全局锁(数据备份)、表级锁(表共享读锁、表独占写锁、元数据锁、意向锁)、行级锁(行锁、间隙锁、临键锁)
- PHP reference manual string (7.2000 words)
- PCA based geometric feature calculation of PCL point cloud processing (52)
- Change the material of unity model as a whole
- Leetcode XOR operation
- nc基础用法3
- How to do product innovation—— Exploration of product innovation methodology I
- 中金财富公司怎么样,开户安全吗
猜你喜欢
Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies
@Mapperscan and @ mapper
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(七)
Distinction between pointer array and array pointer
考研英语唐叔的语法课笔记
如何在BNB链上创建BEP-20通证
[webrtc] add x264 encoder for CEF / Chromium
AQS learning
Openharmony open source developer growth plan, looking for new open source forces that change the world!
Software College of Shandong University Project Training - Innovation Training - network security shooting range experimental platform (8)
随机推荐
Grafana shares links with variable parameters
An error is reported in the initialization metadata of the dolphin scheduler -- it turns out that there is a special symbol in the password. "$“
Shanda Wangan shooting range experimental platform project - personal record (V)
MySQL数据库 - 单表查询(二)
AQS learning
Design of warehouse management database system
Audio editing generation software
[text classification cases] (4) RNN and LSTM film evaluation Tendency Classification, with tensorflow complete code attached
Remote code execution in Win 11 using wpad / PAC and JScript 1
Error reported by Azkaban: Azkaban jobExecutor. utils. process. ProcessFailureException: Process exited with code 127
R language uses econocrats package to create microeconomic or macroeconomic map, visualize indifference function indifference curve, customize calculation intersection, and customize the parameters of
Introduction to electron tutorial 3 - process communication
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(六)
程序设计语言基础(2)
Understanding various team patterns in scrum patterns
Intersection calculation of straight line and plane in PCL point cloud processing (53)
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(五)
MySQL 进阶 锁 -- MySQL锁概述、MySQL锁的分类:全局锁(数据备份)、表级锁(表共享读锁、表独占写锁、元数据锁、意向锁)、行级锁(行锁、间隙锁、临键锁)
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(七)
Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies