/branches/v3/impl/src/java/pt/estgp/estgweb/Globals.java |
---|
125,7 → 125,7 |
public static final String TMP_DIR = ConfigProperties.getProperty("tmp.dir"); |
public static final String DATA_DIR = ConfigProperties.getProperty("data.dir"); |
public static final String JOB_SERVICES_LOG_DIR = ConfigProperties.getProperty("data.dir") + java.io.File.separator + "jobslogs"; |
; |
public static final String EMAIL_SERVER_HOST = ConfigProperties.getProperty("email.server"); |
public static final String EMAIL_SERVER_SECURITY = ConfigProperties.getProperty("email.server.security"); |
public static final int EMAIL_SERVER_SECURITY_TLS = ConfigProperties.getIntProperty("email.server.security.tls"); |
141,7 → 141,11 |
public static final String ADMIN_EMAIL = ConfigProperties.getProperty("admin.email"); |
public static final String ADMIN_EMAIL_2 = ConfigProperties.getProperty("admin.email.2"); |
public static final boolean SYSTEM_EMAIL_USE_SECURITY = ConfigProperties.getBooleanProperty("email.use.security"); |
public static final boolean SYSTEM_EMAIL_USE_ROUND_ROBIN = ConfigProperties.getBooleanProperty("email.use.round.robin"); |
public static final String SYSTEM_EMAIL_BOX = ConfigProperties.getProperty("email.from"); |
public static final String ANNOUNCEMENT_TYPE_NEWS = "news"; |
public static final String ANNOUNCEMENT_TYPE_TOP_FLASH_NEWS = "top.flash.news"; |
public static final String ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS = "bottom.flash.news"; |
/branches/v3/impl/src/java/pt/estgp/estgweb/services/email/SendEmailService.java |
---|
65,15 → 65,19 |
return; |
} |
try{ |
final String sendFromAddress = getRoundRobinEmailUser(); |
final String sendFromAddress = Globals.SYSTEM_EMAIL_USE_ROUND_ROBIN ? |
getRoundRobinEmailUser() : Globals.SYSTEM_EMAIL_BOX; |
// Set up properties for mail session |
Properties props = System.getProperties(); |
props.put("mail.smtp.host", Globals.EMAIL_SERVER_HOST); |
final String username = Globals.EMAIL_SERVER_USERNAME; |
final String password = Globals.EMAIL_SERVER_PASSWORD; |
javax.mail.Authenticator authenticator = null; |
if(Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("TLS")==0) |
if(Globals.SYSTEM_EMAIL_USE_SECURITY && Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("TLS")==0) |
{ |
props.put("mail.smtp.auth", "true"); |
props.put("mail.smtp.starttls.enable", "true"); |
84,7 → 88,7 |
} |
}; |
} |
else if(Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("SSL")==0) |
else if(Globals.SYSTEM_EMAIL_USE_SECURITY && Globals.EMAIL_SERVER_SECURITY != null && Globals.EMAIL_SERVER_SECURITY.compareTo("SSL")==0) |
{ |
props.put("mail.smtp.socketFactory.port", Globals.EMAIL_SERVER_SECURITY_SSL); |
props.put("mail.smtp.socketFactory.class", |
108,7 → 112,10 |
// Get session |
Session session = Session.getDefaultInstance(props, authenticator); |
Session session = authenticator != null ? |
Session.getDefaultInstance(props, authenticator) |
: Session.getDefaultInstance(props) ; |
session.setDebug(true); |
session.setDebugOut(System.out); |