I connect to mail server on protocol smtp on port without encryption. I get error
"Mail server connection failed; nested exception is javax.mail.MessagingException: Could not convert socket to TLS;\n nested exception is:\n\tjavax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake. Failed messages: javax.mail.MessagingException: Could not convert socket to TLS;\n nested exception is:\n\tjavax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake"
My bean's config
@Bean
public JavaMailSender javaMailService() {
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
javaMailSender.setHost(host);
javaMailSender.setProtocol(protocol);
javaMailSender.setUsername(from);
javaMailSender.setPassword(password);
javaMailSender.setPort(port);
javaMailSender.setDefaultEncoding(encoding);
Properties javaMailProperties = new Properties();
javaMailProperties.put("mail.smtp.starttls.enable", "true");
javaMailProperties.put("mail.smtp.auth", "true");
javaMailProperties.put("mail.transport.protocol", "smtp");
javaMailProperties.put("mail.debug", "true");
javaMailProperties.put("mail.smtp.localhost", "127.0.0.1");
javaMailProperties.put("mail.smtp.ssl.trust", "*");
System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
javaMailSender.setJavaMailProperties(javaMailProperties);
return javaMailSender;
}
I can say one before it worked. What can be wrong?