85,17 → 85,21 |
javax.mail.Authenticator authenticator = null; |
if(Globals.SYSTEM_EMAIL_USE_SECURITY && Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("TLS")==0) |
{ |
logger.info("Using Email Security TLS"); |
props.put("mail.smtp.auth", "true"); |
props.put("mail.smtp.starttls.enable", "true"); |
props.put("mail.smtp.port", ""+ Globals.EMAIL_SERVER_SECURITY_TLS); |
authenticator = new javax.mail.Authenticator() { |
|
protected PasswordAuthentication getPasswordAuthentication() { |
System.out.println("Email from:" + sendFromAddress + " pass:" + password); |
return new PasswordAuthentication(sendFromAddress, password); |
} |
}; |
} |
else if(Globals.SYSTEM_EMAIL_USE_SECURITY && Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("SSL")==0) |
{ |
logger.info("Using Email Security SSL"); |
props.put("mail.smtp.socketFactory.port", Globals.EMAIL_SERVER_SECURITY_SSL); |
props.put("mail.smtp.socketFactory.class", |
"javax.net.ssl.SSLSocketFactory"); |
103,6 → 107,8 |
props.put("mail.smtp.port", Globals.EMAIL_SERVER_SECURITY_SSL); |
authenticator = new javax.mail.Authenticator() { |
protected PasswordAuthentication getPasswordAuthentication() { |
System.out.println("Email from:" + sendFromAddress + " pass:" + password); |
|
return new PasswordAuthentication(sendFromAddress,password); |
} |
}; |
116,7 → 122,7 |
|
|
|
|
System.out.println("Autenticator != null :" + (authenticator != null)); |
// Get session |
Session session = authenticator != null ? |
Session.getDefaultInstance(props, authenticator) |