Want more features on Pastebin? Sign Up, it's FREE!
Guest

Using JavaMail with TLS

By: a guest on Feb 27th, 2012  |  syntax: None  |  size: 0.68 KB  |  views: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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");
clone this paste RAW Paste Data