Implemented sending mail using spring injection and removed jetty jndi.

Change-Id: Ie88772800a380f488aaf958fdd49398d32898aa8
diff --git a/full/src/test/resources/kustvakt-test.conf b/full/src/test/resources/kustvakt-test.conf
index 7b19a51..aa76a83 100644
--- a/full/src/test/resources/kustvakt-test.conf
+++ b/full/src/test/resources/kustvakt-test.conf
@@ -12,6 +12,8 @@
 # Kustvakt
 ## mail settings
 mail.enabled = false
+mail.receiver = test-email
+mail.sender = noreply@ids-mannheim.de
 
 ## server
 server.port=8089
diff --git a/full/src/test/resources/test-config.xml b/full/src/test/resources/test-config.xml
index 01a5ba8..22da89a 100644
--- a/full/src/test/resources/test-config.xml
+++ b/full/src/test/resources/test-config.xml
@@ -36,6 +36,8 @@
 			<array>
 				<value>classpath:test-jdbc.properties</value>
 				<value>file:./test-jdbc.properties</value>
+				<value>classpath:properties/mail.properties</value>
+				<value>file:./mail.properties</value>
 				<value>classpath:test-hibernate.properties</value>
 				<value>classpath:kustvakt-test.conf</value>
 			</array>
@@ -306,8 +308,22 @@
 	</bean>
 
 	<!-- mail -->
-	<!-- <bean id="smtpSession" class="org.springframework.jndi.JndiObjectFactoryBean">
-		<property name="jndiName" value="java:comp/env/mail/jetty" />
+	<bean id="authenticator" class="de.ids_mannheim.korap.service.MailAuthenticator">
+		<constructor-arg index="0" value="${mail.username}"/>
+		<constructor-arg index="1" value="${mail.password}"/>
+	</bean>
+	<bean id="smtpSession" class="javax.mail.Session" factory-method="getInstance">
+		<constructor-arg index="0">
+			<props>
+				<prop key="mail.smtp.submitter">${mail.username}</prop>
+				<prop key="mail.smtp.auth">${mail.auth}</prop>
+				<prop key="mail.smtp.host">${mail.host}</prop>
+				<prop key="mail.smtp.port">${mail.port}</prop>
+				<prop key="mail.smtp.starttls.enable">${mail.starttls.enable}</prop>
+				<prop key="mail.smtp.connectiontimeout">${mail.connectiontimeout}</prop>
+			</props>
+		</constructor-arg>
+		<constructor-arg index="1" ref="authenticator"/>
 	</bean>
 	<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
 		<property name="session" ref="smtpSession" />
@@ -320,5 +336,5 @@
 				</prop>
 			</props>
 		</constructor-arg>
-	</bean> -->
+	</bean>
 </beans>
\ No newline at end of file