Add timeout to java mail transport
props.put("mail.smtp.connectiontimeout", "5000"); props.put("mail.smtp.timeout", "5000"); try { //Set the host smtp address Properties props = new Properties(); if (Integer.parseInt(port) == 465) // SSL { props.put("mail.smtp.auth", "true"); props.put("mail.smtp.socketFactory.port", port); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFactory.fallback", "true"); } else {...
Recent Comments