Exception in thread "main" javax.mail.MessagingException: Could not connect to SMTP host: smtp.163.com, port: 25;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2212)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:722)
at javax.mail.Service.connect(Service.java:342)
at javax.mail.Service.connect(Service.java:222)
at javax.mail.Service.connect(Service.java:243)
at com.ailpha.aithink.job.controller.email.EmailUtil.deliverWithMime(EmailUtil.java:68)
at com.ailpha.aithink.job.controller.email.EmailUtil.main(EmailUtil.java:149)
The reason is that the following code is used when SSL is enabled
if (emailConfigModel.getEnSsl() == 0) {
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);
prop.put("mail.smtp.ssl.enable", "true");
prop.put("mail.smtp.ssl.socketFactory", sf);
}
After searching various data, it is found that the port used when using SSL is port 465, not port 25. If SSL is not used, the port is port 25
Read More:
- VirtualBox problem solving set -[drm:vmw_host_log [vmwgfx]] *ERROR* Failed to send host log message
- SQL Server calls Database Mail to send mail error: Msg 229, Level 14, State 5, Procedure sp_send_dbmail, Line 1 EXECUTE
- Load balancing failed to find a valid mailbox database
- Address of campus mailbox POP3 of Nankai University
- PHP under linux uses pdo-dblib to connect to mssql to report an error solution. Error message: SQLSTATE[01002] Adaptive Server connection failed (severity 9)
- Solution to Vue cli · failed to download repo vuejs templates/webpack: connect etimeout followed by an IP digital error message
- How to solve the Mapi error of outbook that can’t send mail directly
- The icon on the layui page is not displayed, and an error message is reported: Failed to decode downloaded font …..
- Android studio — java.lang.nullpointerexception(no error message)
- Use XMLHttpRequest of JavaScript to send data to the background
- When using idea to start a project, an error is reported: Error:java : Compilation failed: internal java compiler error
- Flume receives an error when a single message is too large
- Elasticsearch cluster cannot be started. The following prompt fails to send join request to master appears
- errorCode: 500, msg: , result: {“Message”:”There was an error processing the request
- java.lang.IllegalArgumentException: Address 127.0.0.1:5672:5672 seems to contain an unquoted IPv6
- Java uses ZipFile to decompress the zip file and runs normally under Windows. Linux reports an error
- Java – how to shuffle an ArrayList
- Winsw throws an exception “error 1067: unexpected process termination” when converting Java application to Windows Service
- Java uses the createnewfile() method to report an error
- WCF error “an error occurred when verifying security for the message”… “