Skip to content
Snippets Groups Projects
Commit 3a0369c0 authored by srosse's avatar srosse
Browse files

OO-1691: add configuration for smtp start tls and timeout

parent d7084a15
No related branches found
No related tags found
No related merge requests found
......@@ -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}"/>
......
......@@ -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);
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment