From 07ddbb3a490ef40426c234c75bce91a851ced975 Mon Sep 17 00:00:00 2001
From: Berke Viktor <github.bviktor@outlook.com>
Date: Thu, 08 May 2014 15:13:12 -0400
Subject: [PATCH] Add option to explicitly specify the use of STARTTLS Required for servers that use STARTTLS without SMTPS such as Office 365

---
 src/main/java/com/gitblit/service/MailService.java |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/gitblit/service/MailService.java b/src/main/java/com/gitblit/service/MailService.java
index 4759d17..ae9727f 100644
--- a/src/main/java/com/gitblit/service/MailService.java
+++ b/src/main/java/com/gitblit/service/MailService.java
@@ -68,6 +68,7 @@
 		final String mailUser = settings.getString(Keys.mail.username, null);
 		final String mailPassword = settings.getString(Keys.mail.password, null);
 		final boolean smtps = settings.getBoolean(Keys.mail.smtps, false);
+		final boolean starttls = settings.getBoolean(Keys.mail.starttls, false);
 		boolean authenticate = !StringUtils.isEmpty(mailUser) && !StringUtils.isEmpty(mailPassword);
 		String server = settings.getString(Keys.mail.server, "");
 		if (StringUtils.isEmpty(server)) {
@@ -86,6 +87,7 @@
 		props.setProperty("mail.smtp.port", String.valueOf(port));
 		props.setProperty("mail.smtp.auth", String.valueOf(authenticate));
 		props.setProperty("mail.smtp.auths", String.valueOf(authenticate));
+		props.setProperty("mail.smtp.starttls.enable", String.valueOf(starttls));
 
 		if (isGMail || smtps) {
 			props.setProperty("mail.smtp.starttls.enable", "true");

--
Gitblit v1.9.1