Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r04f70c56cf4d63d83a332402a572c9062f318bbf -r360e2f8861e2162c11f54e995d92919aaa808cd4 --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 04f70c56cf4d63d83a332402a572c9062f318bbf) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 360e2f8861e2162c11f54e995d92919aaa808cd4) @@ -325,6 +325,8 @@ admin.user.authentication.method =Authentication method config.smtp.user =SMTP user config.smtp.password =SMTP password +config.smtp.port =SMTP port +config.smtp.auth.security =SMTP security config.header.red5 =Media server config.red5.server.url =Media server URL config.red5.recordings.url =Media server recordings URL Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/ConfigAction.java =================================================================== diff -u -r098532cd2b5687da032408b04a1120dab668083b -r360e2f8861e2162c11f54e995d92919aaa808cd4 --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/ConfigAction.java (.../ConfigAction.java) (revision 098532cd2b5687da032408b04a1120dab668083b) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/ConfigAction.java (.../ConfigAction.java) (revision 360e2f8861e2162c11f54e995d92919aaa808cd4) @@ -22,6 +22,9 @@ */ package org.lamsfoundation.lams.admin.web.action; +import java.util.LinkedHashMap; +import java.util.Map; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -75,6 +78,11 @@ request.setAttribute("config", getConfiguration().arrangeItems(Configuration.ITEMS_NON_LDAP)); request.setAttribute("countryCodes", LanguageUtil.getCountryCodes(false)); + Map smtpAuthTypes = new LinkedHashMap(); + smtpAuthTypes.put("none", "None"); + smtpAuthTypes.put("starttls", "STARTTLS"); + smtpAuthTypes.put("ssl", "SSL"); + request.setAttribute("smtpAuthTypes", smtpAuthTypes); return mapping.findForward("config"); } Index: lams_admin/web/config/items.jsp =================================================================== diff -u -r098532cd2b5687da032408b04a1120dab668083b -r360e2f8861e2162c11f54e995d92919aaa808cd4 --- lams_admin/web/config/items.jsp (.../items.jsp) (revision 098532cd2b5687da032408b04a1120dab668083b) +++ lams_admin/web/config/items.jsp (.../items.jsp) (revision 360e2f8861e2162c11f54e995d92919aaa808cd4) @@ -27,6 +27,15 @@ + + + + + ${authType.value} + + + + true Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180730.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180730.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20180730.sql (revision 360e2f8861e2162c11f54e995d92919aaa808cd4) @@ -0,0 +1,16 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV-4641 Add SMTP port and authentication type +INSERT INTO lams_configuration (config_key, config_value, description_key, header_name, format, required) +VALUES ('SMTPPort','25', 'config.smtp.port', 'config.header.email', 'LONG', 0), + ('SMTPAuthSecurity','none', 'config.smtp.auth.security', 'config.header.email', 'STRING', 1); + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java =================================================================== diff -u -ra1046dbdfb10ad1f7a61b8d50acbff46ac7c96ab -r360e2f8861e2162c11f54e995d92919aaa808cd4 --- lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision a1046dbdfb10ad1f7a61b8d50acbff46ac7c96ab) +++ lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision 360e2f8861e2162c11f54e995d92919aaa808cd4) @@ -47,6 +47,8 @@ public static String LAMS_EAR_DIR = "EARDir"; public static String SMTP_SERVER = "SMTPServer"; + + public static String SMTP_PORT = "SMTPPort"; public static String LAMS_ADMIN_EMAIL = "LamsSupportEmail"; @@ -217,6 +219,8 @@ public static String SMTP_AUTH_USER = "SMTPUser"; public static String SMTP_AUTH_PASSWORD = "SMTPPassword"; + + public static String SMTP_AUTH_SECURITY = "SMTPAuthSecurity"; public static String PROFILE_EDIT_ENABLE = "ProfileEditEnable"; Index: lams_common/src/java/org/lamsfoundation/lams/util/Emailer.java =================================================================== diff -u -reb5c5f46b64a86127b7c871632172769fa0ec83f -r360e2f8861e2162c11f54e995d92919aaa808cd4 --- lams_common/src/java/org/lamsfoundation/lams/util/Emailer.java (.../Emailer.java) (revision eb5c5f46b64a86127b7c871632172769fa0ec83f) +++ lams_common/src/java/org/lamsfoundation/lams/util/Emailer.java (.../Emailer.java) (revision 360e2f8861e2162c11f54e995d92919aaa808cd4) @@ -58,17 +58,26 @@ */ public static Session getMailSession() { String smtpServer = Configuration.get(ConfigurationKeys.SMTP_SERVER); + String smtpPort = Configuration.get(ConfigurationKeys.SMTP_PORT); Properties properties = new Properties(); properties.put("mail.smtp.host", smtpServer); + properties.put("mail.smtp.port", smtpPort); String smtpAuthUser = Configuration.get(ConfigurationKeys.SMTP_AUTH_USER); String smtpAuthPass = Configuration.get(ConfigurationKeys.SMTP_AUTH_PASSWORD); + String smtpAuthSecurity = Configuration.get(ConfigurationKeys.SMTP_AUTH_SECURITY); Session session = null; if (StringUtils.isBlank(smtpAuthUser)) { session = Session.getInstance(properties); } else { properties.setProperty("mail.smtp.submitter", smtpAuthUser); properties.setProperty("mail.smtp.auth", "true"); + + if (smtpAuthSecurity.equals("starttls")) { + properties.put("mail.smtp.starttls.enable", "true"); + } else if (smtpAuthSecurity.equals("ssl")) { + properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + } SMTPAuthenticator auth = new SMTPAuthenticator(smtpAuthUser, smtpAuthPass); session = Session.getInstance(properties, auth); } @@ -153,7 +162,6 @@ message.setContent(mp); } - Transport.send(message); } } \ No newline at end of file