Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- properties = System.getProperties();
- properties.put("mail.smtp.host", Host);
- properties.put("mail.smtp.port", Port);
- int port = Integer.parseInt(Port);
- URLName urln = new URLName(Host);
- if (TLS) {
- properties.put("mail.smtp.starttls.enable", "true");
- }
- if (SSL) {
- properties.put("mail.smtp.starttls.enable", "true");
- mailSession = Session.getDefaultInstance(properties);
- smtpt = new SMTPSSLTransport(mailSession, urln);
- } else if (authentication) {
- properties.put("mail.smtp.auth", "true");
- mailSession = Session.getDefaultInstance(properties);
- smtpt = new SMTPTransport(mailSession, urln);
- }
- if (mailSession == null) {
- mailSession = Session.getDefaultInstance(properties);
- }
- if (smtpt != null) {
- smtpt.connect(Host, port, User, Pass);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement