diff --git a/src/main/java/org/olat/core/util/_spring/utilCorecontext.xml b/src/main/java/org/olat/core/util/_spring/utilCorecontext.xml index b4dcd6f50c0f5e66d61f86ecd8939f36841af518..83bd3edbf9ed6049a0f9314791213c28807464e5 100644 --- a/src/main/java/org/olat/core/util/_spring/utilCorecontext.xml +++ b/src/main/java/org/olat/core/util/_spring/utilCorecontext.xml @@ -24,11 +24,12 @@ <property name="mailConfig"> <map> <entry key="mailhost" value="${smtp.host}"/> - <entry key="mailTimeout" value="8000"/> <!-- timeout in milliseconds --> + <entry key="mailTimeout" value="${smtp.timeout}"/> <!-- timeout in milliseconds --> <entry key="smtpUser" value="${smtp.user}"/> <entry key="smtpPwd" value="${smtp.pwd}"/> <entry key="sslEnabled" value="${smtp.sslEnabled}"/> <entry key="sslCheckCertificate" value="${smtp.sslCheckCertificate}"/> + <entry key="smtpStarttls" value="${smtp.starttls}"/> <entry key="mailFrom" value="${fromemail}"/> <entry key="mailFromName" value="${fromname}"/> <entry key="mailReplyTo" value="${adminemail}"/> diff --git a/src/main/java/org/olat/core/util/mail/manager/MailManagerImpl.java b/src/main/java/org/olat/core/util/mail/manager/MailManagerImpl.java index 0bf659b01dfe9d80282ef800695bcadcbf1c1073..8ab00be68b15f79d2c7bfaad7754589280837f64 100644 --- a/src/main/java/org/olat/core/util/mail/manager/MailManagerImpl.java +++ b/src/main/java/org/olat/core/util/mail/manager/MailManagerImpl.java @@ -1448,6 +1448,7 @@ public class MailManagerImpl extends BasicManager implements MailManager { String mailhostTimeout = WebappHelper.getMailConfig("mailTimeout"); boolean sslEnabled = Boolean.parseBoolean(WebappHelper.getMailConfig("sslEnabled")); boolean sslCheckCertificate = Boolean.parseBoolean(WebappHelper.getMailConfig("sslCheckCertificate")); + boolean startTls = Boolean.parseBoolean(WebappHelper.getMailConfig("smtpStarttls")); Authenticator smtpAuth; if (WebappHelper.isMailHostAuthenticationEnabled()) { @@ -1465,6 +1466,10 @@ public class MailManagerImpl extends BasicManager implements MailManager { p.put("mail.smtp.connectiontimeout", mailhostTimeout); p.put("mail.smtp.ssl.enable", sslEnabled); p.put("mail.smtp.ssl.checkserveridentity", sslCheckCertificate); + if(startTls) { + p.put("mail.smtp.starttls.enable", "true"); + } + Session mailSession; if (smtpAuth == null) { mailSession = javax.mail.Session.getInstance(p); diff --git a/src/main/resources/serviceconfig/olat.properties b/src/main/resources/serviceconfig/olat.properties index 4bff2de24953d5a9221f82cd2de4dbe6176eeaee..962d2c07523736937ed110c90a65adc4b1f7bccb 100644 --- a/src/main/resources/serviceconfig/olat.properties +++ b/src/main/resources/serviceconfig/olat.properties @@ -123,6 +123,9 @@ smtp.pwd= # enable SSL if your smtp server supports it smtp.sslEnabled=false smtp.sslCheckCertificate=false +smtp.starttls=false +# timeout in milliseconds +smtp.timeout=8000 # system mails will be sent from this address (from local domain with valid reverse dns): fromemail=no-reply@your.domain # the plain text name of the from mail address usually displayed by the email client