javax.mail.MessagingException: Connection reset; nested exception is: java.net.SocketException: Connection reset
I have a service to read mails from outlook. Receiving the above error randomly. What would be the root cause of this issue. Using JAVA 8 and javax.mail-1.6.2 to read mails.
Below is my mail settings
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", "outlook.office365.com");
props.put("mail.smtp.socketFactory.port", "587");
props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "587");
props.put("mail.smtp.starttls.enable", "true");