Closed remote host connection during communication failure while sending mail using Java Mail
I am using Java Mail API Ver. 1.4.2 to send email in a JSF 1.2- Spring based web application. I am using an unsecured SMTP connection to send mail. This email configuration works fine offline. Also tested this utility using JUnit 4 benchmark and I can send mail using an insecure connection.
When I integrate this email module with the main web application, I get the following runtime exception when I send mail.
javax.mail.MessagingException: read exception response; Nested Exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake when com.sun.mail.smtp.SMTPTransport.readServerResponse (SMTPTransport.java:1764) at com.sun.mail.smtp.SMTPTransport.openServer SMTPTransport.java:1523) at com.sun.mail.smtp.SMTPTransport.protocolConnect (SMTPTransport.java:453) at javax.mail.Service.connect (Service.java:317) at javax.mail.Service.connect (Service .java: 176) at javax.mail.Service.connect (Service.java:125) at javax.mail.Transport.send0 (Transport.java:194) at javax.mail.Transport.send (Transport.java:124)
Verified this email module with secure SMTP connection and it works great.
Anyone have an idea on this issue? Why does an unsecured SMTP connection not work when integrated with a web application?
source to share
I am using the email module for secure and unsecured connections. This property resulted in a problem: props.put ("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
Removed this property for unsecured connections and now my unsecured SMTP connection works with web application integration.
source to share