SHARE
TWEET

Using JavaMail with TLS

a guest Feb 27th, 2012 19 Never
  1. Properties props = new Properties();
  2.         props.put("mail.smtp.starttls.enable","true");
  3.         props.put("mail.smtp.auth", "true");  // If you need to authenticate
  4.         // Use the following if you need SSL
  5.         props.put("mail.smtp.socketFactory.port", d_port);
  6.         props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
  7.         props.put("mail.smtp.socketFactory.fallback", "false");
  8.        
  9. javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
  10.        
  11. java.util.Properties props = new java.util.Properties();
  12. props.put("mail.smtp.starttls.enable", "true");
  13.        
  14. props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
RAW Paste Data
Top