Guest User

Untitled

a guest
Jan 20th, 2018
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. String to = "abc@example.com";
  2. String user = "sp@example.com";
  3. String pass = "1234";
  4. Properties props = new Properties();
  5. props.put("mail.smtp.host", "smtp.example.com");
  6. props.put("mail.smtp.port", "587");
  7. props.put("mail.smtp.auth", "true");
  8. props.put("mail.smtp.starttls.enable", "true");
  9. Session session = Session.getInstance(props,new javax.mail.Authenticator()
  10. {
  11. protected PasswordAuthentication getPasswordAuthentication()
  12. {
  13. return new PasswordAuthentication(user,pass);
  14. }
  15.  
  16. session.setDebug(true);
Add Comment
Please, Sign In to add comment