Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. properties = System.getProperties();
  2. properties.put("mail.smtp.host", Host);
  3. properties.put("mail.smtp.port", Port);
  4. int port = Integer.parseInt(Port);
  5. URLName urln = new URLName(Host);
  6. if (TLS) {
  7. properties.put("mail.smtp.starttls.enable", "true");
  8. }
  9. if (SSL) {
  10. properties.put("mail.smtp.starttls.enable", "true");
  11. mailSession = Session.getDefaultInstance(properties);
  12. smtpt = new SMTPSSLTransport(mailSession, urln);
  13. } else if (authentication) {
  14. properties.put("mail.smtp.auth", "true");
  15. mailSession = Session.getDefaultInstance(properties);
  16. smtpt = new SMTPTransport(mailSession, urln);
  17. }
  18. if (mailSession == null) {
  19. mailSession = Session.getDefaultInstance(properties);
  20. }
  21. if (smtpt != null) {
  22. smtpt.connect(Host, port, User, Pass);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement